I'm making a hopperbin, it has 2 parts, 1 to detect when the hopperbin is selected the other is the function of the hopperbin, it works perfectly in studio play mode, why won't it work in game?
Selected Detection Localscript:
isEquipped = false
script.Parent.Selected:connect(function(mouse) isEquipped = true end)
script.Parent.Deselected:connect(function(mouse) isEquipped = false end)
while wait() do
if isEquipped == true then
script.Parent.Function.Disabled = false
elseif isEquipped == false then
script.Parent.Function.Disabled = true
end
end
Function script:
running = false
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(keydown)
keydown:lower()
if keydown == "q" then
running = true
end
end)
game.Players.LocalPlayer:GetMouse().KeyUp:connect(function(keyup)
keyup:lower()
if keyup == "q" then
running = false
end
end)
while wait() do
if running == true then
Workspace.Seat.BodyVelocity.velocity = Vector3.new(0,10,0)
elseif running == false then
Workspace.Seat.BodyVelocity.velocity = Vector3.new(0,0,0)
end
end |