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

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

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

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 comment

1

Explain you answer.

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