The IntValue (which is inside the player, (the name of that IntValue is ‘Skips’)), should increase by the amount of Skips a player bought.
Here is the issue:
The player starts of with 3 free skips. Once they use those 3 skips, they may want to buy let’s suppose 2 more skips. Now the IntValue before was 3 which is now 0 because they used their skips. And after they bought 2 skips through a developer product, they are supposed to have 2 skips. Because they bought 2 skips after finishing their default 3 skips. * But they don’t have 2 skips now (in their IntValue), instead, they have 5*.
But they are supposed to get 2.
I think that this is because the IntValue still has 3 skips but it is showing that the player has 0 skips so when the player buys 2 more skips. It’s adds it with 3 and not with 0.
Let me give you just one more example. Now the player has 5 skips left and he uses 2 skips. So he has 3 left. Now he buys 2 more skips and the IntValue changes from 3 to 7. The IntValue is considering the value still 5 despite showing 3. And when the player buys 2 skips, it adds it with the 5 skips.
This is the developer products page, which gives the player the additional skips (normal script):
local MarketPlaceService = game:GetService("MarketplaceService")
MarketPlaceService.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == (Id of the product (I have added it correctly ) then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
player.SkipStages.Skips.Value += 1
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == (Id of the product (I have added it correctly)) then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
player.SkipStages.Skips.Value += 2
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Although I have a local script inside a gui which when the player click (the textbutton), this local script get’s run:
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats"):FindFirstChild("Stage")
local skipStages = player:WaitForChild("SkipStages"):FindFirstChild("Skips")
local hasLimits = true
local Limits = skipStages.Value
local maxLevels = game.Workspace.MaxStages.Value -- This is the total amount of stages in the game.
script.Parent.MouseButton1Click:Connect(function()
print("Clicked!")
if hasLimits == true then
print("Has Limits == true!")
if leaderstats.Value < maxLevels then
print("Limits is greater than 0!")
if skipStages.Value > 0 then
leaderstats.Value = leaderstats.Value + 1
skipStages.Value = skipStages.Value - 1 -- HERE IT IS. THE CODE THAT SUBTRACTS THE AMOUNT OF SKIPS THE PLAYER HAS.
print("Subtracted Limits!")
if player ~= nil then
print("Player is not nil")
if player.Character ~= nil then
print("Players character is not nil")
if player.Character:FindFirstChild("Humanoid").Health > 0 then
print(player.Character)
player.Character.HumanoidRootPart.CFrame = game.Workspace.Checkpoints:FindFirstChild(leaderstats.Value).CFrame + Vector3.new(0,3,0)
print("You should have been teleported!")
end
end
end
else
script.Parent.Parent.NotEnoughSkipsLeft.Visible = true
if player ~= nil then
if player.Character ~= nil then
if player.Character:FindFirstChild("Humanoid").Health > 0 then
player.Character.HumanoidRootPart.CFrame = game.Workspace.Checkpoints:FindFirstChild(leaderstats.Value).CFrame + Vector3.new(0,3,0)
end
end
end
end
end
end
end)
And just in case you needed the script which creates the Skips value (normal script):
game.Players.PlayerAdded:Connect(function(player)
local SkipStages = Instance.new("Folder", player)
SkipStages.Name = "SkipStages"
local Skips = Instance.new("IntValue", SkipStages)
Skips.Name = "Skips"
Skips.Value = 3
Thanks for any help