I’m making a thing where players can lock on and automatically walk towards objects by clicking on them, and cancel the movement when they want to by forcing the character to move (W, A, S, D on the keyboard and the pad on mobile). I’m also trying to make this compatible with mobile devices but I can’t find a way to detect movement input from mobile devices. Does anyone know how I might make this compatible with mobile devices?
1 Like
Humanoid:MoveTo()
should work here. It makes a character walk to the Vector3 position you input, and gets aborted when the player moves.
There’s a HumanoidStateType that you can use called Running
Ex:
humanoid.Running:Connect(function(speed)
if speed > 0.05 then -- I do this check because sometimes the Running speed registers as > 0 for some odd reason even when you're not moving
-- They're walking ---
end
end)
OR
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Running or new == Enum.HumanoidStateType.Climbing or new == Enum.HumanoidStateType.Jumping then
-- They did something --
end
end)
Yes but it doesn’t remove all the extra effects added when locked on and if the humanoid doesn’t reach its target in 8 seconds, it just counts it as TargetReached
I’m currently using Humanoid:MoveTo() to move the players so wouldn’t this detect that movement as well?
Yes. It would.
[ Need to reach character requirement lol]