Help with skip a stage script

Hi, I’m currently making a game and I was going to add the ability to skip a stage. I have made the ui for it but my current script doesn’t even let you buy it. I have essentially no knowledge of scripting so I looked on YouTube but from what I gathered they all only work with a different checkpoint script. How would I go about making one?

Here is my checkpoint script if it helps

local Players = game:GetService(“Players”)

Players.PlayerAdded:Connect(function (plr)
local leaderstats =“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = plr

local v ="IntValue")
v.Name = "Stage"
v.Value = 0
v.Parent = leaderstats

plr.CharacterAdded:Connect(function (char)
	local hum = char:WaitForChild("Humanoid")
	local hrp = char:WaitForChild("HumanoidRootPart")
	if hum.Health > 0 then
		hrp.CFrame ="Stage" .. tostring(v.Value)).CFrame.Position +, 5, 0))
		if hit.Parent == workspace.Checkpoints then
			if hit.Name == "Stage" .. tonumber(v.Value + 1) then
				v.Value = v.Value + 1


1 Like

Can i see what in workspace is Checkpoints folder? any error?

1 Like

In order for this to work you’ll need a local script in the stage part, along with a bindable event in replicated storage and a script in serverscriptservice. The local script will grab the values it needs then sending it to the event. The event will then send it to the server script so it can process the information into what you want.

Here’s the checkpoint folder if that’s what you mean.

And I should probably add the stage skip script I’ve got already:

MarketplaceService = Game:GetService(“MarketplaceService”)

MarketplaceService.ProcessReceipt = function(receiptInfo)
players = game.Players:GetPlayers()

currency = “Stage”

done = 0

for i=1,#players do
if players[i].userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 1085572136 and done == 0 then
done = 1
players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
players[i].Character.Humanoid.Health = 0
done = 0
return Enum.ProductPurchaseDecision.PurchaseGranted

It would make the script much easier if you replace the Name of these Stages from “Stages0” to “0”. Just saying :smirk:

You’ve missed one crucial thing about scripting, the client and server. Here are some links to help you with your code:

Ok this is really embarrassing. I missed out 1 letter in the prompt script and now it works perfectly. Thanks for all youu guys help though.

1 Like