Scripting A Free Skip Stage For People Joining My Group

Hello everyone! I was wondering how I would go about scripting a free skip stage when someone joins my group. I already have a partial script set up that fetches data to see if the person is in the group or not but I am not sure how to script it so that they get the free stage skip. I will include my skip stage script and my partial joining group script. I am not entirely sure how to go about this since I’m still learning scripting but any help is appreciated! :smiley:

Joining Group Partial Script:

local groupid = 16957880
local devProductID = 1388352883

game.Players.PlayerAdded:Connect(function(plr)
	if plr:GetRoleInGroup(groupid) ~= "Guest" then
		
	end
end)

Skip Stage Script:

local mps = game:GetService("MarketplaceService")
local devProductID = 1388352883

mps.ProcessReceipt = function(purchaseInfo)
	local plrPurchased = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)
	if not plrPurchased then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if purchaseInfo.ProductId == devProductID then
		if tonumber(plrPurchased.leaderstats.Stage.Value) < #workspace.Checkpoints:GetChildren() - 1 then
			plrPurchased.leaderstats.Stage.Value = plrPurchased.leaderstats.Stage.Value + 1
			
				
		else
			
			plrPurchased.leaderstats.Stage.Value = "End"
			
		end
		
		plrPurchased:LoadCharacter()
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

Try this

local groupid = 16957880
local devProductID = 1388352883

game.Players.PlayerAdded:Connect(function(plr)
	if plr:GetRoleInGroup(groupid) ~= "Guest" then
		if tonumber(plr.leaderstats.Stage.Value) < #workspace.Checkpoints:GetChildren() - 1 then
			plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1	
		else
			plr.leaderstats.Stage.Value = "End"
		end
		plr:LoadCharacter()
	end
end)

1 Like

Idk what’s wrong but for some reason my skip stage button doesn’t work anymore. It worked yesterday but it’s not skipping me forward like it used to, strangely enough.

so i am not really able to help you for now
fix your code and send it here :slight_smile:

1 Like

Alright so I fixed the script (Another script I was using was interfering between the two for some reason) I did test out the script that you provided and it did skip the person to the next stage but is it possible to store the skip or do I have to make a new script/new button entirely in order for that to be possible?