I am trying to make a script that changes a team when clicked a gui, but the problem is it doesnt say it is changing the team in chat and all the scripts for that team does not work because it thinks i am not in the team.
my local script:
local button = script.Parent
local button = script.Parent
local function onButtonActivated()
local player = game.Players.LocalPlayer
local teamName = “Traitor”
local buyer = script.Parent.Parent.Parent.Parent.Parent
cash = buyer.leaderstats[“Cash”]
if cash.Value < 500 then return end
if cash.Value >= 500 then
player.Team = game.Teams[teamName]
cash.Value = cash.Value - 500
end
end
button.Activated:Connect(onButtonActivated)