Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This script isn't working. What can I do to fix it?

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!

1 answer

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!

17 comments

0

Sorry, i'm confused on what you mean by "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"."

0

Basically you need to have the first IntValue's name set to leaderstats (leaderstats.Name = "leaderstats") and set the other variable(Rank)'s name to "Rank" (Rank.Name = "Rank")

0

Err, it's set up like that. Sorry, i'm very new to scripting and I don't really understand.

0

You have to call Rank.Name = "Rank" to set what the stat's Name is. You have to call leaderstats.Name = "leaderstats" so it'll show the Rank's Value.

0

I don't understand by leaderstats, but i'll try the script.

0

Nope, did not work.

0

Leaderstats hold all the stats to show, as long as the name is "leaderstats" you should see all of the values excluding ObjectValues.

0

The name is leaderstats. I took the code as it was but changed the id = (my group rank here) and that is all.

0

What is it doing?

0

Not really anything. It just shows the player list normally.

0

Anything in the lua output?

0

Lua output?

0

The output in Roblox Studio

0

Don't know what you mean. :|

0

Oh, it says error, etc. I'm not really sure.

0

Could you run the script again and put the error into pastebin? No account needed.

This discussion is preserved as it was. New answers, comments, and votes are closed.