How do I make a skip stage script?

I am currently making a difficulty chart obby but I want to add a skip stage feature, I am honestly a complete and utter idot when it comes to scripting so of course I don’t know how to make a skip stage feature.
image these are the scripts I have in ServerScriptService (they all work) and I have image with all the stage parts in them, hope this helps

1 Like

What is the error in the output?

All I have is a button and I don’t know how to script in a code which lets you actually skip the stage

Unfortunately you haven’t provided much information, besides your set-up, so you’re stage skip would depend on how your obby is wired, and it’s functionalities. If you can care to provide a brief explanation of how your obby works and its mechanism that would be much helpful to finding a solution to your problem.

Here’s a great resource by @0Techy that includes a stage skipper:

1 Like

Okay basically so there’s a checkpoints folder with all the checkpoints labelled with numbers. I have 2 scripts in ServerScriptService, a leaderstats script that looks like this:

local DS = game:GetService(“DataStoreService”):GetDataStore(“Stage Save”)
local function OnCharacterAdded(char)
game:GetService(“RunService”).Stepped:Wait()
local plr = game.Players:GetPlayerFromCharacter(char)
char:WaitForChild(“HumanoidRootPart”).CFrame = workspace.Checkpoints[tostring(plr.TeleportedStage.Value)].CFrame + Vector3.new(0,3.25,0)
end

function OnPlayerAdded(plr)

plr.CharacterAdded:Connect(OnCharacterAdded)

plr.CharacterAdded:Connect(OnCharacterAdded)

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

local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Parent = stats

local TeleStage = Instance.new("IntValue")
TeleStage.Name = "TeleportedStage"
TeleStage.Parent = plr

local key = "id_" .. plr.userId

local data = DS:GetAsync(key)

if data then
	stage.Value = data
	TeleStage.Value = stage.Value
else
	DS:GetAsync(key, stage)
end

end

game.Players.PlayerAdded:Connect(OnPlayerAdded)

function OnPlayerRemoved(plr)
local key = “id_”…plr.userId
local data = plr.leaderstats.Stage.Value
DS:SetAsync(key, data)
end

game.Players.PlayerRemoving:Connect(OnPlayerRemoved)

And another script called UpdateStageHandler that looks like this:

for _, v in pairs(workspace.Checkpoints:GetChildren()) do
v.Touched:Connect(function(hit)
if v ~= nil then
if v.Parent == workspace.Checkpoints then
local player = game:GetService(“Players”):GetPlayerFromCharacter(hit.Parent)
if player then
if player.leaderstats.Stage.Value == tonumber(v.Name) - 1 then
player.leaderstats.Stage.Value += 1
player.TeleportedStage.Value = player.leaderstats.Stage.Value
end
end
end
end
end)
end

In StarterGui I have a button that presses and right now it only charges you and doesn’t give anything, image I want to make it so it actually skips the stage.

You could increase the players stage value and then use :LoadCharacter() to get the player to the next stage.

1 Like

You would have to add a remote function for it to actually work and skip stages

Your skip stage script appears to only be adding the player’s Stage value, you have another value you need to add to called TeleportedStage.