This is what some guy helped me with, but it doesnt seem to work! I want to have it like: A guy is on the Bright red team, and as soon as I team him to Bright blue, the GUI needs to be gone!
for i, v in pairs (game.Players:GetPlayers()) do if v.TeamColor == "Bright blue" then -- If the player is in the Bright blue team for i, obj in pairs (v:WaitForChild("PlayerGui"):GetChildren()) do if obj:IsA("ScreenGui") then -- Just in case obj:Destroy() end end end end
This should work i commented what i changed
for i, v in pairs (game.Players:GetChildren()) do --Get the Children instead if v.TeamColor == BrickColor.new(23) then -- BrickColor Codes work better sometimes 23 is Bright blue for i, obj in pairs (v:WaitForChild("PlayerGui"):GetChildren()) do if obj:IsA("ScreenGui") then obj:remove() --remove instead of destroy because logic end end end end
Marked as Duplicate by Shawnyg and Goulstem
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?