You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear! - I want my script to realise when my player tries to move
What is the issue? Include screenshots / videos if possible! - im relatively new to scripting and i dont know how to achieve this
What solutions have you tried so far? Did you look for solutions on the Developer Hub? - i tried looking through all the properties of a humanoid and there arent any properties that show me if the player is trying to move
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Ok so here’s the full issue - im trying to make an animation gui and its working perfectly except for the fact that my player can walk while the animation is running, so i planned on setting the walkspeed to 0 when the animation is running and to set it back to 16 when the player tries to move again, the problem is that i dont know how to detect when the player tries to move his character, im sorry if this is a dumb question im quite new to scripting
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
After a quick search i found out that the humanoid of the player has a property called: MoveDirection.
If it’s value is greater than 0 then the player is moving.
MoveDirection cannot determine when a player has Moved or stopped moving this only calculates the direction in which a players goes in a x and z axis wdym lol
Broooo it clearly says in the API that it tells the direction in which a player is going in a x or z axis it cannot tell when a character has stopped moving or not
Ok so this is a local script that must be in starterCharacterScripts i clearly borrowed from the link
local RunService = game:GetService("RunService")
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local function IsWalking()
wait(0.2)
if humanoid.MoveDirection.Magnitude > 0 then -- Are we walking?
print("Walking")
end
end
RunService.RenderStepped:Connect(IsWalking)
Thanks so much it worked! heres the script i used:
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Model") then
if v:FindFirstChildWhichIsA("Humanoid") then
local humanoid = v.Humanoid
while true do
if humanoid.MoveDirection.Magnitude > 0 then -- Are we walking?
print("he moved")
end
wait()
end
end
end
end