local button = script.Parent
local debounce = false
local rebirthCost = 50
local rebirthInterval = 0.20
local players = game:GetService("Players")
local function updateButtonColor(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local money = leaderstats:FindFirstChild("Money")
if money then
if money.Value >= rebirthCost then
button.Color = Color3.fromRGB(0, 255, 0)
else
button.Color = Color3.fromRGB(255, 0, 0)
end
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
updateButtonColor(player)
local leaderstats = player:WaitForChild("leaderstats")
local money = leaderstats:WaitForChild("Money")
money.Changed:Connect(function()
updateButtonColor(player)
end)
end)
end)
button.Touched:Connect(function(hit)
local character = hit.Parent
local player = players:GetPlayerFromCharacter(character)
if player and not debounce then
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local money = leaderstats:FindFirstChild("Money")
local rebirths = leaderstats:FindFirstChild("Rebirths")
local buttonsPressed = leaderstats:FindFirstChild("ButtonsPressed")
if money and rebirths and buttonsPressed then
if money.Value >= rebirthCost then
debounce = true
money.Value = 0
** You are now Level 17! **