local qingyun = script.Parent.Frame.Qingyun
local tianying = script.Parent.Frame.Tianying
local thousand = script.Parent.Frame.Thousand
local longevity = script.Parent.Frame.Longevity
local fenxiang = script.Parent.Frame.Fenxiang
local ghostking = script.Parent.Frame.Ghost
local Player = game.Players.LocalPlayer
function choose_faction(name)
local Leaderstat = Player.leaderstats.Faction
Leaderstat.Value = name
end
script.Parent:Destroy()
end
qingyun.MouseButton1Click:connect(function() choose_faction("Qing Yun") end)
tianying.MouseButton1Click:connect(function() choose_faction("Tian Ying") end)
thousand.MouseButton1Click:connect(function() choose_faction("Thousand Poison") end)
longevity.MouseButton1Click:connect(function() choose_faction("Longevity") end)
fenxiang.MouseButton1Click:connect(function() choose_faction("Fen Xiang") end)
ghostking.MouseButton1Click:connect(function() choose_faction("Ghost King") end)
Hi this is my script for changing class when you click a textbutton, But I am having trouble changing your Team Color based on what button you click.

2 comments
I got it to works thanks! but now it only works in studio but not in Play Mode
@luadotorg, on the local Player variable, also add after the game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()