01 local GroupID = 1 02 03 game.Players.PlayerAdded:connect(function(player) 04 local stats = Instance.new("IntValue") 05 local rank = Instance.new("StringValue", stats) 06 rank.Value =player:GetRoleInGroup(GroupID) 07 stats.Parent = player 08 --[[player.CharacterAdded:connect(function(character) 09 local groupSpawns = game.Workspace:FindFirstChild("GroupSpawns"):GetChildren() 10 local torso = character:WaitForChild("Torso") 11 torso.CFrame = CFrame.new(groupSpawns[math.random(1,#groupSpawns)].Position) 12 end)]] 13 end)
I'm putting it in StarterGui, Workspace, StarterPack, ServerScriptService, etc and it doesn't work.
I'm putting the group id in the second line where it says local GroupID = (my group id here) am I doing this correctly?
I'm totally new to scripting, and i'd appreciate it if you helped me out. Thanks!
The script isn't correct in order for it to show in a leaderboard you need to have the stat's name equal to "leaderstats" and rank's name to "Rank".
id = 1 game.Players.PlayerAdded:connect(function(P) leaderstats = Instance.new("IntValue", P) leaderstats.Name = "leaderstats" local Rank = Instance.new("StringValue", P.leaderstats) Rank.Name = "Rank" Rank.Value = P:GetRoleInGroup(id) end) --[[player.CharacterAdded:connect(function(character) local groupSpawns = game.Workspace:FindFirstChild("GroupSpawns"):GetChildren() local torso = character:WaitForChild("Torso") torso.CFrame = CFrame.new(groupSpawns[math.random(1,#groupSpawns)].Position) end)]]
If this helped vote this up and accept as an answer, it says that I helped you with something. Thanks!