I’m currently trying to get a double rebirths script for an example. I keep finding tutorials on how to make them but they just seem to double my currency everytime I rejoin the game. Here’s the script, please tell me how to fix it. I’m a beginner scripter.
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 oldcash = Instance.new("NumberValue",folder)
oldcash.Name = "OldCoins"
oldcash.Value = currency.Value
local give2x = Instance.new("NumberValue",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 > oldcash.Value then
give2x.Value = currency.Value - oldcash.Value
currency.Value = currency.Value + give2x.Value
oldcash.Value = currency.Value
can = true
else
oldcash.Value = currency.Value
can = true
end
end
else
oldcash.Value = currency.Value
end
end)
end
end
end)
I’m using StringValues for the gamepassID and the Currency I want to use.