Hey, I've tried adding 'end to fix it, I've also tried to put () but nothing seems to work. Any tips?
The last 'end' is errored with this: https://imgur.com/a/iqCZvTV
local productId1 = 976013381 -- 15
local productId2 = 976013480 -- 50
local productId3 = 976016228 -- 150
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.leaderstats.Stage.Value == 111 then -- change number to stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3) -- make Id2 the id of the diff cost
else
if game.Players.LocalPlayer.leaderstats.Stage.Value >= 51 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId2)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value <= 49 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId1)
end
end
end
end)
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.leaderstats.Stage.Value == 10 then -- change number to stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId2) -- make Id2 the id of the diff cost
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 20 then -- change number to stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId2) -- make Id2 the id of the diff cost
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 30 then -- change number to stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId2) -- make Id2 the id of the diff cost
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 40 then -- change number to stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId2) -- make Id2 the id of the diff cost
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 50 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId2)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 60 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 70 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 80 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 90 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 100 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3)
else
if game.Players.LocalPlayer.leaderstats.Stage.Value == 110 then -- change the number to the stage
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId3)
end
end
end
end
end
end
end
end
end
end
end
end
end

3 comments
Please indent your code properly so it's easier for us to read and therefore figure out your problem.
First off why do you got so many "end"
Well first of all, this is horribly formatted. You can make this much easier with math and functions that take about 30 lines max.