Hello! In my game, I am trying to make a double coins gamepass. Each round, the player should earn 5 coins (so double coins would give them 10). The gamepass works, and 10 coins are rewarded. However, if you don't own the gamepass, you sometimes receive 5 coins like you are supposed to and other times you receive 15 coins.
- No errors are given
- This has only been tested in singleplayer
- The script only happens once, because the Wins go up only 1. (This is the purpose of having some of the variables) -
Thanks to anyone who attempts to help!
script.Parent.Touched:Connect(function(p)
local char = p.Parent.Name
local player = game.Players:FindFirstChild(char)
local numWins = player.leaderstats.Wins.Value
local numCoins = player.leaderstats.Coins.Value
local CoinsEarned = 5
player.Character.HumanoidRootPart.CFrame = game.Workspace.LOBBYTELE.CFrame
wait(2)
local service = game:GetService("MarketplaceService")
if service:UserOwnsGamePassAsync(player.userId,8519306) == true then
CoinsEarned = 10
end
player.leaderstats.Coins.Value = numCoins + CoinsEarned
player.leaderstats.Wins.Value = numWins + 1
end)

1 comment
Thank you! This definitely easier to read than what I had lol :)