Help with "second chance" obby gamepass

Hello. I’m currently developing an obby that kicks you if you die. I also made a gamepass that gives you a free pass to die and respawn once but if you die again you get kicked. I declared a variable called chanceUsed which is false by default. However the pass gives you unlimited chances even if you don’t have the second chance gamepass. Any suggestions? I used the example code given on the Creator Hub Documentation article about game passes.

if hasPass then
	if chanceUsed then
		player:Kick("You have been kicked for dying in the obby. Rejoin to try again!")
	else
		chanceUsed = true
	end
else
	player:Kick("You have been kicked for dying in the obby. Rejoin to try again!")
end
1 Like

im not the smartest when it comes to gamepass scripting but if i was in this position id much rather make this a developer product that you can buy multiple times but for this i would make a int/number value in the character of the player (that also saves with data stores) and probably check if they have 0 chances left or not before they respawn but this is just a recommendation from me

Could you maybe send the whole script or the all the parts related to this?

Maybe this would work?

if hasPass == true then
	if chanceUsed == true then
		player:Kick("You have been kicked for dying in the obby. Rejoin to try again!")
	else
		chanceUsed = true
	end
end

@BladeskiesRBX
Can you show the whole script?