Hey there all,

I’ve been running into this issue where a TouchedEvent is not working the way I want it to. What I’m trying to create is where when you touch a part it slows down the player.

But in the video shown below, it slows down the player and speeds the player back up when they exit the part, and then completely breaks once you try to touch it again.


Here is my code (In a ServerScript ) :

for _, part in WalkspeedChangerFolder:GetChildren() do

	if not part:IsA("Part") then return end
	if not part:GetAttribute("SetWalkspeed") then return end
	
	part.Touched:Connect(function(hit)

		if not hit.Parent then return end
		if not hit.Parent:FindFirstChild("Humanoid") then return end
		
		local Humanoid: Humanoid = hit.Parent:FindFirstChild("Humanoid")
		Humanoid.WalkSpeed = part:GetAttribute("SetWalkspeed")
		
	end)
end

Thanks a lot!

Maybe you have some other script interfering with walkspeed? maybe some kind of anticheat?
The script looks totally fine and there shouldnt be anything wrong with it

1 Like

yeah exactly what I was thinking, but it works when you wait a while and then touch the part. I think it has to do something with the character loading.

Do you possibly have a wait() or task.wait() sometime earlier in the script?

1 Like

Well if its not possible to reach it before the character has fully loaded then there shouldnt be anything to worry about

1 Like

yeah, I think ill just add a wait until character apparence loaded when its touched.