Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How does this script make a part slow a character down?

I have snow and the cancollide is on false so I can go through it. However, I want to make it so it slows the character down.

This is my horrible guess.

game.Workspace.Part --that is as much as I can guess.. I need more experience on this stuff
Ontouch:connect character
Connected = speed (5)

Alright tell me how I did.

1 answer

✓ Accepted answer
local part = script.Parent

function slowdown(h)
	local hum = h.Parent:FindFirstChild("Humanoid")
	if hum ~= nil then
		hum.WalkSpeed = x --The amount you want to set it to
	end
end

part.Touched:connect(slowdown)

This will affect the enemies as well and not just the players, btw. You'll have to ask a different question if you want to know how to make it specifically affect the players.

Let me know if this works or or not v v v

function setnormal(h)
	local hum = h.Parent:FindFirstChild("Humanoid")
	if hum ~= nil then
		hum.WalkSpeed = x --The amount you want to set it to
	end
end

part.TouchEnded:connect(setnormal)

2 comments

0

Is there any way to make it so that when they get off the part it goes back to normal?

0

Yeah.

This discussion is preserved as it was. New answers, comments, and votes are closed.