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

How to change the player's walkspeed after he touch the part?

Asked by
Revgery 15
3 years ago

So like the main thing is when player touch the part, his walkspeed turns into 64

I already did a code, but it isn't work, pls help

game.Workspace.part.Touched:Connect(function(hit) game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 64 end)

0
I'll test lo_1003 42 — 3y
0
y'know its alot easier if u just put script.Parent instead of game.Workspace.part Zeuxulaz 148 — 3y

1 answer

Log in to vote
0
Answered by
lo_1003 42
3 years ago
Edited 3 years ago

I know the problem you are using a "game.Players.LocalPlayer.Character.Humanoid.Walkspeed = 64" though is only for local script but i don't know how to do it in local script but i do know how to do this in script. Here's the prefix.

local part = game.Workspace.Part
part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.Humanoid.WalkSpeed = 64
    end
end)

if it doesn't work put the script inside the part and change this:

local part = game.Workspace.Part

to

local part = script.Parent
0
Tysm, lo_1003, you helped me so much Revgery 15 — 3y
0
You should accept their answer RazzyPlayz 497 — 3y
Ad

Answer this question