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

my Leadrboard script isnt working at all and i need help!?

its not showing up

local function onPlayerJoin(player)
	
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local gold = Instance.new("IntValue")
    gold.Name = "Kevinrux"
    gold.Value = 0
    gold.Parent = leaderstats

end


its not showing up on the screen when i test play

2 answers

✓ Accepted answer

You forgot to call the function when a player joins, so you might do something like this

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local gold = Instance.new("IntValue")
    gold.Name = "Kevinrux"
    gold.Value = 0
    gold.Parent = leaderstats
end)

I think you forgot to call/connect the function. Try this:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)

    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local gold = Instance.new("IntValue")
    gold.Name = "Kevinrux"
    gold.Value = 0
    gold.Parent = leaderstats

end)

7 comments

0

Still doesnt work

0

Is that script a ServerScript (Normal Script) inside ServerScriptStorage?

0

Yes

0

ServerScriptService

0

Okay, i'm gonna edit my post, hold on.

0

Try that.

0

and you accepted another person's answer...

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