(code block fixed)
Hey there,
I've been having a issue with my team switch GUI. Basically, we have this GUI were you click, and it is supposed to switch your team to the other. (in this case, it should switch you to the "deep blue" team. But, for some reason, when I click it, it does nothing.
Here is my script:
function Click(mouse) if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(2544404) then script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Deep blue") end end script.Parent.MouseButton1Click:connect(Click)
Thank you to anyone that can help! (note that I am a beginner scripter!) -Rolerain
Please put your code in appropriate Lua code block next time
I can think of two reasons why that wouldn't work
1) - You're not indexing the player correctly.
2) - There is no team with a TeamColor
of 'Deep Blue'
So just to make sure.. why dont you make this a localscript and access the player by game.Players.LocalPlayer
. You should be using a localscript for the IsInGroup
method anyways, because it returns live results, while using it in a server script returns cached results. Meaning that if the player leaves / joins the group while they're in the game then they don't have to rejoin.. if you use this in a localscript.
local id = 2544404 --Group ID local teamColor = 'Deep blue' --TeamColor local plr = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() if plr:IsInGroup(id) then plr.TeamColor = BrickColor.new(teamColor) end end)
Locked by Goulstem and M39a9am3R
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?