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

If someone presses a gui and is on a certain team, how do I give them more speed or more health?

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
if Player ~= nil then 
if Player.TeamColor == game.Teams.Pirus.TeamColor then
	Player.Humanoid.Walkspeed = 100
end
end
script.Parent.MouseButton1Click:connect(Click) 

Hello, I am Yeevivor4. What I'm trying to make is that, if you click on a gui, it puts you on a team. What I'm trying to do is that, if you press on that gui and you're on the team, you will get 100 walkspeed. I don't know why it is not working. Can any GUI geniuses help me with this? Also script.Parent.Parent.Parent.Parent.Parent.TeamColor is just the Player's TeamColor.

~Thanks for reading, Yeevivor4.

2 answers

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
if Player ~= nil then 
if Player.TeamColor == game.Teams.Pirus.TeamColor then
    Player.Humanoid.WalkSpeed = 100 --WalkSpeed
end
end
script.Parent.MouseButton1Click:connect(Click) 

You could add a Value into the player and check if the player's value is a certain number like

if player.Torso.IntValue.Value >= 3 then 
-- Your Script here
end

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