I'm making a simple boat script. When I sit in the boat a tool is given to me and when I press 'W' when using this tool then the boat will move forward. The only problem is that when I'm done using the boat, and when the HopperBin is gone if I try to press 'W' to move it won't work! Is it like the tool locked 'W' for itself only?
local function onUpdate()
if ship then -- check is there is a ship
if movingF then -- if the button for moving forward is pressed
ship.BodyVelocity.velocity = ship.BodyVelocity.velocity+ship.CFrame.lookVector -- move the ship in the direction it's facing
end
if not movingF then -- stop the ship when the button is not being pressed
ship.BodyVelocity.velocity = Vector3.new(0,0,0)
end
end
end
RunService:BindToRenderStep('Control', Enum.RenderPriority.Input.Value, onUpdate)
contextAction:BindAction('Forward', onForward, true, 'w', Enum.KeyCode.Up, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA) -- to set the control for forward movement
I think the problem is the 'BindToRenderStep' but I'm not sure (I was inspired by this tutorial http://wiki.roblox.com/index.php?title=Making_a_2D_Platformer) For some reason, I'm not able to use the key 'W' to move ever again after using the tool once.
