I made this script which checks if the player is running, and if he is the particleEmitter is enabled else
its false
local hum:Humanoid = script.Parent.Humanoid
local walk = script.Parent.HumanoidRootPart.WalkParticle.Walk
hum.StateChanged:Connect(function(old,new)
if new == Enum.HumanoidStateType.Running then
walk.Enabled = true
print("running")
else
walk.Enabled = false
end
end)
try adding a print in else
and another print once function is triggered
hum.StateChanged:Connect(function(old,new)
print("state changed")
if new == Enum.HumanoidStateType.Running then
walk.Enabled = true
print("running")
else
walk.Enabled = false
print("not running")
end
end)
this will help you understand more of what’s going on
You can just use Humanoid.Running which will fire if the player is running.
Humanoid.Running:Connect(function()
...
end)
Edit: Second example that uses Humanoid.Running:
local function onRunning(speed)
if speed > 0 then
print("Player is running")
else
print("Player has stopped")
end
end
workspace.Player.Humanoid.Running:Connect(onRunning)