Help with walk effects

i’m trying to make an animal crossing like game and I wanted to make a dust like effect when the player walks outside, I just don’t know how to check if the player is walking,

here is the code

btw I know that it will only work If the player is walking forward, still doesn’t work

local Char = script.Parent

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Effect = ReplicatedStorage:WaitForChild("DirtParticle")
local LeftEffect = Effect:Clone()
LeftEffect.Parent = Char.LeftFoot
local RightEffect = Effect:Clone()
RightEffect.Parent = Char.RightFoot
	
if Char.Humanoid.MoveDirection.X > 0 or Char.Humanoid.MoveDirection.z > 0 then
	LeftEffect.Enabled = true
	RightEffect.Enabled = true
else
	LeftEffect.Enabled = false
	RightEffect.Enabled = false
end
3 Likes

Please be more specific, no one will help you if your topic is not specific

1 Like

You can use a very simple Running event, like this:

Char.Humanoid.Running:Connect(function(speed) -- Running function
if speed > 0 then -- Checks the speed
LeftEffect.Enabled = true   
RightEffect.Enabled = true
else
if speed <= 0 then
LeftEffect.Enabled = false
RightEffect.Enabled = false
end
end
end)

This basically runs an event when the player is moving, and checks to see if their speed is over or under 0.

3 Likes

I wanted to know how to check if the player is moving so that when they are, the effect will be be active, if they are not, the effect will not be active

ok, then his solution is correct

the only thing I had to change was that you checked if the speed was less or more than zero, it needed to check if the speed was 0 or less instead otherwise it always stayed on

Yeah, my bad, that was a typo. At least it worked!

Im Also Trying to make this how did you Created this on replicatedstorage?. Or in the game in general

1 Like

Here is the script:

local Char = script.Parent

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Effect = ReplicatedStorage:WaitForChild("DirtParticle")
local LeftEffect = Effect:Clone()
LeftEffect.Parent = Char.LeftFoot
local RightEffect = Effect:Clone()
RightEffect.Parent = Char.RightFoot

Char.Humanoid.Running:Connect(function(speed) -- Running function
	if speed > 0 then -- Checks the speed
		LeftEffect.Enabled = true   
		RightEffect.Enabled = true
	else
		if speed <= 0 then
			LeftEffect.Enabled = false
			RightEffect.Enabled = false
		end
	end
end)

add a particle in replicated storage and rename it to DirtParticle I am also trying to make a animal corssing game and it worked for me

1 Like

You do realize that this topic was solved over a year ago right?

I replied to @Milkywastaken not to the person who created the post