So basically here I am stuck on this for 2 days now, and I can’t figure it out.
Here are some screenshots :
So basically here I created a value inside the character which works really well.
But then, I tried to change the value of it to true when the player moves. But it didn’t work at all. Why?
Here is the code that makes the value to true when MoveDirection is 0,0,0.
You are not changing the value of boolValue object, instead you are changing the variable itself to true
Basically you missed .Value in IsMoving = true
IF that code is ran in a local script only the client will have access to the changed value. To make the server know that a certain character is moving you should use a RemoteEvent so the server can edit the BoolValue and then retrieve it if needed
local Character = script.Parent
local IsMoving = Instance.new("BoolValue")
IsMoving.Name = "IsMoving"
IsMoving.Parent = Character
Character.Humanoid.MoveDirection:GetPropertySignalChanged("MoveDirection"):Connect(function()
if Character.Humanoid.MoveDirection == Vector3.New(0, 0, 0) then
IsMoving.Value = false
else
IsMoving.Value = true
end
end)
LocalScript in StarterCharacterScripts Please.
also i typed it on mobile so formatting might be off.