Hello so in my game i wanna do a 10x coin event, the problem is, it wont let me go past x4 and when you rejoin the game, your coins will multiply by 4, and this is the same for my 2x coin gamepass. heres the script.
x2 coin gamepass
game.Players.PlayerAdded:Connect(function(player)
local marketservice = game:GetService("MarketplaceService")
local can = true
repeat wait() until player:FindFirstChild("leaderstats")
local leader = player:FindFirstChild("leaderstats")
if leader then
repeat wait() until leader:FindFirstChild(script:WaitForChild("Currency").Value)
local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
if currency then
local folder = Instance.new("Folder",player)
folder.Name = "2xGamepass"
local oldmoney = Instance.new("IntValue",folder)
oldmoney.Name = "OldMoney"
oldmoney.Value = currency.Value
local give2x = Instance.new("IntValue",folder)
give2x.Name = "Give2x"
give2x.Value = 0
currency.Changed:Connect(function()
if marketservice:UserOwnsGamePassAsync(player.UserId, script:WaitForChild("GamepassId").Value) then
if can == true then
can = false
if currency.Value > oldmoney.Value then
give2x.Value = currency.Value - oldmoney.Value
currency.Value = currency.Value + give2x.Value
oldmoney.Value = currency.Value
can = true
else
oldmoney.Value = currency.Value
can = true
end
end
else
oldmoney.Value = currency.Value
end
end)
end
end
end)
coin event script (which also stopped working… idk why…)
game.Players.PlayerAdded:Connect(function(player)
local can = true
repeat wait() until player:FindFirstChild("leaderstats")
local leader = player:FindFirstChild("leaderstats")
if leader then
repeat wait() until leader:FindFirstChild(script:WaitForChild("Currency").Value)
local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
if currency then
local folder = Instance.new("Folder",player)
folder.Name = "CoinEvent"
local oldmoney = Instance.new("IntValue",folder)
oldmoney.Name = "OldMoney"
oldmoney.Value = currency.Value
local give4x = Instance.new("IntValue",folder)
give4x.Name = "Give4x"
give4x.Value = 0
if can == true then
can = false
if currency.Value > oldmoney.Value then
give4x.Value = currency.Value - oldmoney.Value
currency.Value = currency.Value + give4x.Value
oldmoney.Value = currency.Value
can = true
else
oldmoney.Value = currency.Value
can = true
end
end
end
end
end)
Can anyone help me make this so i can go past 4x and so your coins dont multiply when you rejoin? if you can thank you!
P.S. i know im just using my coin gamepass for my coin event, but idk what else to use for an event. so if anyone could possibly tell me another way to do it, id be grateful!
oh and, they dont stack…