So when you click a certain button on the GUI, it is meant to team you to a certain team.
Visible
while true do wait(10) script.Parent.Visible = true end
RGH
local groupid = "1142229" function Click(Player) if Player:IsInGroup(groupid) then Player.TeamColor = BrickColor.new("Institutional white") Player.Humanoid.Health = 0 else end end script.Parent.MouseButton1Click:connect(Click)
PMC
local groupid = "2567972" function Click(Player) if Player:IsInGroup(groupid) then Player.TeamColor = BrickColor.new("Lime green") Player.Humanoid.Health = 0 else end end script.Parent.MouseButton1Click:connect(Click)
TRGH
local groupid = "2580112" function Click(Player) if Player:IsInGroup(groupid) then Player.TeamColor = BrickColor.new("Navy blue") Player.Humanoid.Health = 0 else end end script.Parent.MouseButton1Click:connect(Click)
SGH
local groupid = "2586305" function Click(Player) if Player:IsInGroup(groupid) then Player.TeamColor = BrickColor.new("Earth green") Player.Humanoid.Health = 0 else end end script.Parent.MouseButton1Click:connect(Click)
You are trying to get Player from MouseButton1Click when the player is not passed by that function. Since these scripts are running on the client, you have access to game.Players.LocalPlayer
, so local Player=game.Players.LocalPlayer
should be written at the top.
Humanoid also is not a member of Player, it is a member of Player.Character.
local Player=game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() if Player:IsInGroup("1142229")then Player.TeamColor=BrickColor.new("Institutional white") Player.Character.Humanoid.Health=0 end end)
You keep putting Player
as the parameter, but the MouseButton1Click
event doesn't have any built-in parameters.
Therefore Player
will always be nil.
The solution is super easy. LocalScripts (which these all should be - they're in GUIs, after all.) have access to the LocalPlayer
property, so we can just use that to get the person clicking.
local Player = game.Players.LocalPlayer ---all your other stuff