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.
Well, the issue here is that you didn't even try changing the team color.
I've scripted for you a small script that will change your team color.
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) Player:WaitForChild('leaderstats').Faction.Value = name Player.TeamColor = game:GetService("Teams"):WaitForChild(name).TeamColor 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)
Hope this helps you!