Script is not working

Hello Developers,
Im currently working on this Script.

local SkipEasyStages = 1262347949
local SkipModerateStages = 1262348510
local SkipHardStages = 1262348510
local SkipIntenseStages = 1262348984 
local SkipRidiculousStages = 1262349206
local SkipImpossibleStages = 1262349440
local SkipFirst10FinalPredicamentStages = 1262349886 
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Stage = leaderstats:WaitForChild("Stage")

script.Parent.MouseButton1Click:connect(function()
	if Stage.Value < 1 and Stage.Value > 49 or Stage.Value == 1 or Stage.Value == 49 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipEffortlessStages)
	
	elseif Stage.Value < 50 and Stage.Value > 99 or Stage.Value == 50 or Stage.Value == 99 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipEasyStages)
	
	elseif Stage.Value < 100 and Stage.Value > 149 or Stage.Value == 100 or Stage.Value == 149 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipModerateStages)
	
	elseif Stage.Value < 150 and Stage.Value > 199 or Stage.Value == 150 or Stage.Value == 199 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipHardStages)
	
	elseif Stage.Value < 200 and Stage.Value > 249 or Stage.Value == 200 or Stage.Value == 249 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipIntenseStages)
	
	elseif Stage.Value < 250 and Stage.Value > 299 or Stage.Value == 250 or Stage.Value == 299 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipRidiculousStages)
	
	elseif Stage.Value <= 300 and Stage.Value > 324 or Stage.Value == 300 or Stage.Value == 324 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipImpossibleStages)
	
	elseif Stage.Value < 325 and Stage.Value > 334 or Stage.Value == 325 or Stage.Value == 334 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipFirst10FinalPredicamentStages)
	end
end)

The Script should PromptPurchase a different Product if a Button is clicked. For this the Script should check the Value called Stage in leader stats. If the Value is higher then 0 and below Stage 45 for example. But the Script is not working, when I Click the Button the prompt product purchase doesn’t appears… Any help would be appreciated!

try using remote events and printing, try in a script, try send a video

The Prompt Product Purchase is using a ServerScript to Handle the Skip Stage. Could you explain a bit more in detail please?

ok

should bedone in a local script

and

should be done in a script

No, I am pretty sure you can prompt purchases using market place service through local scripts, there is nothing wrong with that.

I have gone through your script, if there are no errors, the problem must be in the if statements, I have done this before and I know this is annoying but I am pretty sure its all about the if statements, you just need to make changes right there.

What kind of changes? I already tried with if instead of else if , I also used <= and >= checks…

1 Like

There is something wrong with the statements you’ve put, check them. For example if the player’s level is 0 and he wants to skip the stage, you’ve put
if Stage.Value < 1 and Stage.Value > 49 or Stage.Value == 1 or Stage.Value == 49 then
So in the above line it checks if the players level is smaller than 1, which is true and then it moves on and checks if the players Stage is greater than 49, which is not true. Now, idk why you put it there cause if the level is less than one, it cannot be more than 49.

So the issue really is that the script is working fine but the statements you’ve put are wrong, is why the script checks for all of them and none of them is correct so nothing happens.

1 Like

I just want to make it so:
1262347720 – Skip Effortless Stages [0-49] - R$5

1262347949 – Skip Easy Stages [50-99] - R$15

1262348510 – Skip Moderate Stages [100-149] - R$25

1262348751 – Skip Hard Stages [150-199] - R$35

1262348984 – Skip Intense Stages [200-249] - R$45

1262349206 – Skip Ridiculous Stages [250-299] - R$60

1262349440 – Skip Impossible Stages [300-324] - R$75

1262349886 – Skip First 10 Final Predicament Stages [325-334] - R$95
the numbers are the stage where you should be in. Since im new at Scripting is there a way how to make that?

Well, lemme just make a few changes to your script and it should be alright. It is my pleasure.

1 Like
local SkipEasyStages = 1262347949
local SkipModerateStages = 1262348510
local SkipHardStages = 1262348510
local SkipIntenseStages = 1262348984 
local SkipRidiculousStages = 1262349206
local SkipImpossibleStages = 1262349440
local SkipFirst10FinalPredicamentStages = 1262349886 
local SkipEffortlessStages = 1262347720

local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Stage = leaderstats:WaitForChild("Stage")

script.Parent.MouseButton1Click:connect(function()
	if Stage.Value >= 0 and Stage.Value < 50 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipEffortlessStages)

	elseif Stage.Value > 49 and Stage.Value < 100 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipEasyStages)

	elseif Stage.Value > 99 and Stage.Value < 150 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipModerateStages)

	elseif Stage.Value > 149 and Stage.Value < 200 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipHardStages)

	elseif Stage.Value > 199  and Stage.Value < 250 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipIntenseStages)

	elseif Stage.Value > 249  and Stage.Value < 300 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipRidiculousStages)

	elseif Stage.Value > 299  and Stage.Value < 325 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipImpossibleStages)

	elseif Stage.Value > 324  and Stage.Value < 335 then
		game:GetService("MarketplaceService"):PromptProductPurchase(player, SkipFirst10FinalPredicamentStages)
	end
end)

Try this.

Thank you so much it works! I gave u the solution mark :smiley:

1 Like