I am trying to make it so when a player clicks a button (It's a ScreenGui) their team will be changed and their player will be loaded. Here's my script I can't figure out what i'm doing wrong. Btw this is a local script
--TEAM CHANGE--
local allowedTeam = BrickColor.new("White"); -- the color of the team they have to be on for it to change their team color--
local changedTeam = BrickColor.new("Really red"); -- the color i want them to change to when they click the button--
script.Parent.Mousebutton1Click:Connect(function()
local plr = game.Players.LocalPlayer
if plr then
if plr.TeamColor == allowedTeam then
plr.TeamColor = changedTeam;
plr:LoadCharacter();
end
end
end)
