Need help to make a skip stage script

Hello I would need help on a skip stage script as I tried every tutorials I could found and others stuff but nothing was working, so if someone could help me make one with the stage script below working (By purchasing a dev product it tp to next stage) it would be really cool and if its working im willing to give some robux to the person that helped me thanks :smiley:

local Stages = workspace:WaitForChild("Stages")

for i,Stage in pairs(Stages:GetChildren()) do
		
	Stage.Touched:Connect(function(touch)
			
		local humanoid
		
		if touch.Parent:FindFirstChild("Humanoid") then
			
			humanoid = touch.Parent.Humanoid
		end
		
		if touch.Parent and touch.Parent.Parent:FindFirstChild("Humanoid") then
			
			humanoid = touch.Parent.Parent.Humanoid
		end
		
		if humanoid then
			
			local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
			
			local PlayerStage = player.leaderstats.Stage.Value
			
			if tonumber(Stage.Name) == PlayerStage + 1 then
				
				player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
			
			elseif tonumber(Stage.Name) > PlayerStage + 1 then
				
				humanoid.Health = 0
			end
		end
	end)
end

7 Likes

Its easier to name the stages like 1, 2, 3 and just do humanoid.Torso.CFrame = Value name here.Value

1 Like

They are in a folder and i name then 1,2,3 but i just don’t know how to make a skip stage button work

If they buy the product, just add the stage value to 1 and tp them to the stage:

-- The code that tp the player to the next stage
player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
player.Character.HumanoidRootPart.CFrame = "stage block name".CFrame -- Note: You may get stuck in the block.
1 Like

And how can I make that they get tp only if they bough the products?

-- Local script for the button that purchase dev product
MPS = game:GetService("MarketplaceService")
id = 000000000 -- replace with your ID
local player = game.Players.LocalPlayer
 
script.Parent.MouseButton1Click:connect(function()
    MPS:PromptProductPurchase(player, id)
end)
-- Script that handle the purchase
local MPS = game:GetService("MarketplaceService")
 
MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 000000000 then -- replace with your ID here
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
        player.Character.HumanoidRootPart.CFrame = "stage block name".CFrame
    end
end

For more information, read the wiki about the dev product.

4 Likes

Okay thanks you i’ll try :slight_smile:

I’m not the best with this thing, I just use a free model for this kind of thing, I take the script I need, copy it and past it into my gui! Normally I just take the model.

1 Like

I already tried that but these free models doesnt work for me

1 Like

Could you send me the link of one of the free models that worked for you?

Okay just one moment as I will pull up the game link and open up the studio. I am playing a game and replying and helping people all at once that is why I might take a bit to reply.

2 Likes

I can’t find the name of the model, I will copy the model and make it a model on the website and let you take it then after you take it put it off sale. So please let me know when you take it. https://web.roblox.com/library/5107037632/Test

If it is for an obby, then it should work because it worked for me. For some reason, I just really like editing posts of mine. I know that might be spamming so I won’t do it as much.

Okay thanks you i took it ill see if it work

Test it and purchase it. NOTICE: Make sure to make your own developer product or else when people purchase it the robux would go to me. And put the id of your developer product in it. If it doesn’t work and when you buy it and it gives you the stage plus, try resetting your character because it does it for me when I reset my character.

okay thanks you but maybe it wont work because we have a different stage script ill still try ty

Okay, your welcome! I hope it works for you because I have been in that kind of pain before and it’s not fun.

Did it work for you? I hope it did because it works for me.

Yes I will try it soon ill give you feedback on it

Okay thank you! Take your time for trying it.