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

Why isn't this working even though I put it in a local script?

Asked by
Yeevivor4 155
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
function Click(mouse)
if script.Parent.Parent.Parent.Parent.Parent.TeamColor ~= game.Teams.Pirus.TeamColor then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = game.Teams.Pirus.TeamColor
end
end
Player = script.Parent.Parent.Parent.Parent.Parent
Humanoid = game.Players:findFirstChild("Humanoid")
if Player ~= nil then
if Player.TeamColor == game.Teams.Pirus.TeamColor then
   Player.Humanoid.WalkSpeed = 100 --WalkSpeed
end
end
script.Parent.MouseButton1Click:connect(Click)

What I'm trying to do is when you press a GUI button, you will be on the team and once you're on that team, you'll get 100 walkspeed. When I press it, it doesn't work. The character walkspeed of the person doesn't change at all. What is wrong with this script?

1 answer

Log in to vote
0
Answered by 10 years ago

MY GOODNESS I'VE ALREADY FIXED THIS FOR YOU. I REMEMBER DOING IT.

But here it is again.

function Click()
    Player = game.Players.LocalPlayer
    Player.Character:WaitForChild("Humanoid")
    Humanoid = Player.Character.Humanoid
    if Player.TeamColor ~= game.Teams.Pirus.TeamColor then
        Player.TeamColor = game.Teams.Pirus.TeamColor
        Player.Humanoid.WalkSpeed = 100 --WalkSpeed
    end
end

script.Parent.MouseButton1Down:connect(Click)

There were so many things wrong, that I just fixed them and I don't want to list them.

1
Explain you answer. YasuYoshida 171 — 10y
Ad

Answer this question