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

Adding a limit so you can't skip stage at the end of the obby?

local module = require(game.Workspace:FindFirstChild("Techy's Obby System").Configurations)
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	if game.Workspace[player.Name].leaderstats.Stage.Value < game.Workspace.SkipStageLimit.Value then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, module.skipStageProductID)
	end
end)

1 comment

0

I believe the main problem is line 5.

1 answer

Fixed it on my own, no worries.

local module = require(game.Workspace:FindFirstChild("Techy's Obby System").Configurations)
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	if tonumber(player.leaderstats.Stage.Value) < game.Workspace.SkipStageLimit.Value then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, module.skipStageProductID)
	end
end)

the reason it didn't work is because the leaderstats is a string value and I needed to convert it into an integer.

2 comments

0

If anyone else is having this problem, use tonumber.

0

you can also add some code so if they dont purchase it they get respawned.

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