Help with leaderstats

Hello, I made an obby…and the leaderstats for the checkpoints are working in the studio but not when you play the game in roblox…Could anyone help?


Studio


Roblox

Can you show us the script? Can you show us the error in the developer console while playing the game? Please be more descriptive.

Also this should be in #help-and-feedback:scripting-support.

1 Like

Have you check the console or the logs?

1 Like

Is the game actually being published?

1 Like

yes…I have tried it many times.

local checkpoints = workspace:WaitForChild(“Checkpoints”)

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 = 1
stage.Parent = leaderstats

player.CharacterAdded:Connect(function(char)
	local hum = char:WaitForChild("Humanoid")
	wait()
	char:MoveTo(checkpoints[stage.Value].Position)

	hum.Touched:Connect(function(hit)
		if hit.Parent == checkpoints then
			if tonumber(hit.Name) == stage.Value + 1 then
				stage.Value = stage.Value + 1
			end
		end
	end)
end)

end)

would it matter if the script wasn’t committed?

Yes it would, make sure to commit your scripts.

Well…it says it is not able to commit. It exactly says check the status.

Does somebody else have access to the game? If so then you’ll have to copy and paste the script and then discard the draft, then re-paste the script in.

1 Like

What do you mean? Like delete the script then re paste it?

Yes, that’s exactly what I mean. (make sure to copy it BEFORE deletion)