Hello. I am planning on making a fishing system on my game, where you click a button and it makes your character walk into a specific position and then stop moving, and then give you control over your character once you exit. How would I prevent the character from moving/turning, whilst allowing the script to force them to walk?
3 Likes
Use ContextActionService an UnBind events such as “moveForwardsAction” to stop them from walking. Then you can use Humanoid:MoveTo()
because you didn’t disable the walkspeed.
2 Likes
Don’t unbind them because you can’t bind them later, or it’s rather more difficult to do so. Use ControlModule:Disable.
3 Likes
Thanks, I will look into that method.
2 Likes
To add some code based on colbert’s solution, this is what I do in my game when the player enters “edit mode” and their movement is disabled:
local PLAYER = game:GetService( 'Players' ).LocalPlayer
local Control = require( PLAYER:WaitForChild( 'PlayerScripts' ):WaitForChild( 'PlayerModule' ):WaitForChild( 'ControlModule' ) )
-- Later on in the script, when entering my edit mode:
Control:Disable()
-- And when returning to normal:
Control:Enable()
9 Likes