Help with leaderstats

Hello Developers!

I have a script that doesn’t work when I play the game!
The script is a script from an AlvinBlox Video and its a leaderstats script.

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

local serverStorage = game:GetService("ServerStorage")

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

local strength = Instance.new("NumberValue")
strength.Name = "Strength"
strength.Parent = leaderstats

local rebirths = Instance.new("IntValue")
rebirths.Name = "Rebirths"
rebirths.Parent = leaderstats

local dataFolder = Instance.new("Folder")
dataFolder.Name = player.Name
dataFolder.Parent = serverStorage.RemoteData

local debounce = Instance.new("BoolValue")
debounce.Name = "Debounce"
debounce.Parent = dataFolder

end)

I hope you guys read this!:stuck_out_tongue_winking_eye:

you didnt define whats player variable is

Hello, how are you doing?

Did you put the script inside ServerScriptService or Workspace?

Also, i’m pretty sure when you’re going to make a leaderstats folder, the first letter cannot be upper case.

He did specify it, right here:

oh im sorry i didnt notice…

It’s alright, the first and last line weren’t preformatted, so it did get a little confusing.

Which letter are you talking about?

I’m pretty sure the L cannot be uppercase.

2 Likes
game.Players.PlayerAdded:Connect(function(player)

local serverStorage = game:GetService("ServerStorage")

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

local strength = Instance.new("NumberValue")
strength.Name = "Strength"
strength.Parent = leaderstats

local rebirths = Instance.new("IntValue")
rebirths.Name = "Rebirths"
rebirths.Parent = leaderstats

local dataFolder = Instance.new("Folder")
dataFolder.Name = player.Name
dataFolder.Parent = serverStorage.RemoteData

local debounce = Instance.new("BoolValue")
debounce.Name = "Debounce"
debounce.Parent = dataFolder
end)

You’re missing an “end)” at the last line.

1 Like

Oh my god thank you! It works now!

No problem, check the upper case next time. The folder is case sensitive, make sure to always put the lower case at the start!

I didn’t miss the end) it just cut it out of the script.

I see, thought that reply wasn’t directed to you.