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

How to instantly skip 50 stages but use it only one time?

Let's Say I am in stage 14 I want to be in stage 50 but how could I do it so that the player goes to it but doesn't be able to purchased again

MarketplaceService = Game:GetService("MarketplaceService")

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

local currency = "Stage"

done = 0

for i=1,#players do
	if players[i].userId == receiptInfo.PlayerId then
		if receiptInfo.ProductId == 967779711 and done == 0 then
			done = 1
			players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 50
			players[i].Character.Humanoid.Health = 0
				done = 0
				
		end
	end
end
return Enum.ProductPurchaseDecision.PurchaseGranted	
end``
local amount
local stagesskipped
local stages = 112 -- the amount of stages the player is at stages
for i = 1,50 do-- 50 is the max amount of times the for statement will have to run
    local number = stages+i
    local end2 = string.sub(number,string.len(number)-1,string.len(number))--this gets the last two numbers of the stage
    if tonumber(end2) == 00 or tonumber(end2) == 50 or tonumber(number) == 0 then amount = number stagesskipped = i end-- if the number ends in 00 50 or the original number is 0 (in case the stage number is negitive)
end
print(amount,stagesskipped)--the amout is the stage of which the player's stage should be at and stageskipped is the amount of stages the player skipped

3 comments

1

use a gamepass

1

Could it be done as a dev product?

0

he wants it so if the stage is 49 the stage will be 50 if it is 25 it will be 50 if it is 52 it will be 100 you get the idea

1 answer

local amount
local stagesskipped
local stages = -put the players stage here
for i = 1,50 do-- 50 is the max amount of times the for statement will have to run
	local number = stages+i
	local end2 = string.sub(number,string.len(number)-1,string.len(number))--this gets the last two numbers of the stage
	if tonumber(end2) == 00 or tonumber(end2) == 50 or tonumber(number) == 0 then amount = number stagesskipped = i end-- if the number ends in 00 50 or the original number is 0 (in case the stage number is negitive)
end

hope this helped!

3 comments

0

tell me if there are any bugs!

1

ok let me give it a try

1

17:29:42.843 - Players.thestorm2897.PlayerGui.SkipStageScript:4: Expected identifier when parsing expression, got 'do'

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