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

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

Asked by
Yeevivor4 155
10 years ago
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

Log in to vote
1
Answered by
Relatch 550 Moderation Voter
10 years ago
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) 

Ad
Log in to vote
-1
Answered by 10 years ago

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

Answer this question