it better be a local script and because you said
local Player = game.Players.LocalPlayer
The Player won't load in the actual game... Try doing this...
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
wait(1)
local Player = game:GetService("Players").LocalPlayer
local Leaderstat = Player.Stats.Faction
local Leaderstat = Player.Stats
function choose_faction(name)
local Leaderstat = Player.Stats.Faction
Leaderstat.Value = name
Player.TeamColor = BrickColor.new("Cyan")
Player:LoadCharacter()
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)
if that won't work using PlayerAdded like this..
game:GetService("Players").PlayerAdded:connect(function(Player)
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 Leaderstat = Player.Stats.Faction
local Leaderstat = Player.Stats
function choose_faction(name)
local Leaderstat = Player.Stats.Faction
Leaderstat.Value = name
Player.TeamColor = BrickColor.new("Cyan")
Player:LoadCharacter()
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)
end)
2 comments
You are using the same Variable name twice. local Leaderstat rename it.
Do not only post code, or only post an explanation. Both are required to make a good question.