Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make so the player needs to go in the obby checkpoints in order?

Hello! I'm making an obby that has checkpoints, and I want to make the player need to go to the checkpoints in order. Because I don't want hackers to teleport from the first stage to the last stage.

I tried to make my script make sense but it does not and is of course not going to actually work

I tried making this script hoping it will work but that's before finding out that it does not make sense that it will work.

local part = script.Parent

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		local stagesnow = player.leaderstats.Stage.Value
		if player.leaderstats.Stage.Value ~= stagesnow - 1 then
			stagesnow = stagesnow + 1
			player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + stagesnow - 1
		end
		end
end)

script.Parent.CheckPointScript.Disabled = true

So I am having trouble with that. What do I need to do so it can make sense?

1 comment

0

there is a value inside the player called "RespawnLocation" (or something like that). Try experimenting with that (maybe set the script to update it to that part).

1 answer

Hello friend! I was also having this same issue around a year ago. Here's the fix for it:

script.Parent.Touched:Connect(function(touched)
	local plr = game.Players:GetPlayerFromCharacter(touched.Parent)
	local stageCount = plr.leaderstats.Stage
	if stageCount.Value -> stageCount.Value + 1 then
		stageCount.Value = stageCount.Value + 1
	elseif stageCount.Value > stageCount.Value + 1 then
		touched.Parent.Humanoid.Health = 0
	end
end)

Basically what I did here was I checked if the player was gaining more than a single stage at a time, it just automatically kills the player.

This discussion is preserved as it was. New answers, comments, and votes are closed.