Help leaderstats script not working

Trying to make leaderstats but its not working

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

local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Value = 0
stage.Parent = leaderstats

local secret stage = Instance.new("IntValue")
secret stage.Name = "Secret Obby Stage"
secret stage.Value = 0
secret stage.Parent = leaderstats

end)

2 Likes

You have a space in “secret stage” which is not valid. Rename the variable to “secret_stage”

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

local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Value = 0
stage.Parent = leaderstats

local secret_stage = Instance.new("IntValue")
secret_stage.Name = "Secret Obby Stage"
secret_stage.Value = 0
secret_stage.Parent = leaderstats
end)
1 Like

still didnt work in game. I dont get why?

1 Like

I realize that your quotes are for some reason weird. Try this:

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

	local stage = Instance.new("IntValue")
	stage.Name = "Stage"
	stage.Value = 0
	stage.Parent = leaderstats

	local secret_stage = Instance.new("IntValue")
	secret_stage.Name = "Secret Obby Stage"
	secret_stage.Value = 0
	secret_stage.Parent = leaderstats
end)
2 Likes