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

My script isn't functioning as I intend it to?

Asked by 1 year ago

I bet the answer is super simple but here it is:

game.Players.PlayerAdded(function(player)

    local leaderstats = Instance.new("Folder",player)
    leaderstats.name = "leaderstats"

    local Level = Instance.new("IntValue", leaderstats)
    Level.name = "Level"

end)

1 answer

Log in to vote
0
Answered by
0x5y 105
1 year ago

When posting, you should describe the issue you are having in detail, and also describe anything you have tried to fix the issue.

By looking at your code, there doesn't seem to be anything wrong at first, but I do notice you are missing a :Connect()

Here's how to fix it:

game.Players.PlayerAdded:Connect(function(player) -- added :Connect()

    local leaderstats = Instance.new("Folder",player)
    leaderstats.name = "leaderstats"

    local Level = Instance.new("IntValue", leaderstats)
    Level.name = "Level"

end)
0
Thanks! Puppy_lovertheawsome 84 — 1y
Ad

Answer this question