Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
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

Log in to vote
0
Answered by
Gamenew09 180
10 years ago

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!

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"." Alyssall 0 — 10y
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") Gamenew09 180 — 10y
0
Err, it's set up like that. Sorry, i'm very new to scripting and I don't really understand. Alyssall 0 — 10y
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. Gamenew09 180 — 10y
View all comments (13 more)
0
I don't understand by leaderstats, but i'll try the script. Alyssall 0 — 10y
0
Nope, did not work. Alyssall 0 — 10y
0
Leaderstats hold all the stats to show, as long as the name is "leaderstats" you should see all of the values excluding ObjectValues. Gamenew09 180 — 10y
0
The name is leaderstats. I took the code as it was but changed the id = (my group rank here) and that is all. Alyssall 0 — 10y
0
What is it doing? Gamenew09 180 — 10y
0
Not really anything. It just shows the player list normally. Alyssall 0 — 10y
0
Anything in the lua output? Gamenew09 180 — 10y
0
Lua output? Alyssall 0 — 10y
0
The output in Roblox Studio Gamenew09 180 — 10y
0
Don't know what you mean. :| Alyssall 0 — 10y
0
Oh, it says error, etc. I'm not really sure. Alyssall 0 — 10y
0
Could you run the script again and put the error into pastebin? No account needed. Gamenew09 180 — 10y
Ad

Answer this question