Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Bricks That Slow Movement While Inside Them [SOLVED] [closed]

Asked by
Corogl 0
10 years ago

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?

Locked by TheMyrco

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
1
Answered by
nate890 495 Moderation Voter
10 years ago

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)
Ad
Log in to vote
0
Answered by 10 years ago

Use the TouchEnded event.

part.TouchEnded:connect(function(p)
    --// Set humanoid's walkspeed like you did with Touched.
end)
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? Corogl 0 — 10y
Log in to vote
0
Answered by
Corogl 0
10 years ago

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?