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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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)
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
Still doesnt work Jim63FourFun 11 — 4y
0
Is that script a ServerScript (Normal Script) inside ServerScriptStorage? youtubemasterWOW 2741 — 4y
0
Yes Jim63FourFun 11 — 4y
0
ServerScriptService Jim63FourFun 11 — 4y
View all comments (3 more)
0
Okay, i'm gonna edit my post, hold on. youtubemasterWOW 2741 — 4y
0
Try that. youtubemasterWOW 2741 — 4y
0
and you accepted another person's answer... youtubemasterWOW 2741 — 4y

Answer this question