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

Bricks That Slow Movement While Inside Them [SOLVED]

So I understand how to make a brick change your movespeed once you touch it, but once you are no longer touching said brick your speed returns does not change, so it is still modified. I am struggling with how to make it so that when you are touching/inside of a brick, you move slowly, 8, but as soon as you are no longer in contact your move speed returns to normal.

I am wondering if this is possible, and if so what must be done? If not do I just need to surround the brick that sets my speed to 8 with other bricks that return the speed to 16?

3 answers

✓ Accepted answer

Something like this is what you're looking for I believe:

script.Parent.Touched:connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		humanoid.WalkSpeed = 10
		script.Parent.TouchEnded:wait()
		humanoid.WalkSpeed = 16
	end
end)

Use the TouchEnded event.

part.TouchEnded:connect(function(p)
	--// Set humanoid's walkspeed like you did with Touched.
end)

1 comment

0

This does not seem to work in compatability with the movespeed script I am using. Do you mind showing me what the full script would look like so that I can fix it?

This does not seem to work in compatability with the movespeed script I am using. Do you mind showing me what the full script would look like so that I can fix it?

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