script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.leaderstats.Clicks.Value < 300 then
script.Parent.Text = "Not Enough!"
wait(2)
script.Parent.Text = "1 REBIRTH │ 500 CLICKS"
end
if game.Players.LocalPlayer.leaderstats.Clicks.Value >= 300 then
game.Players.LocalPlayer.leaderstats.Rebirths.Value = game.Players.LocalPlayer.leaderstats.Rebirths.Value +1
game.Players.LocalPlayer.leaderstats.Clicks.Value = 0
game.Players.LocalPlayer.leaderstats.Gems.Value = game.Players.LocalPlayer.leaderstats.Gems.Value + 10
end
end)
您所需要做的只是乘二,而不是加一。试试这个:
script.Parent.MouseButton1Click:Connect(function() if game.Players.LocalPlayer.leaderstats.Clicks.Value < 300 then
script.Parent.Text = "Not Enough!"
wait(2)
script.Parent.Text = "1 REBIRTH │ 500 CLICKS"
end
if game.Players.LocalPlayer.leaderstats.Clicks.Value >= 300 then
game.Players.LocalPlayer.leaderstats.Rebirths.Value = game.Players.LocalPlayer.leaderstats.Rebirths.Value *2
game.Players.LocalPlayer.leaderstats.Clicks.Value = 0
game.Players.LocalPlayer.leaderstats.Gems.Value = game.Players.LocalPlayer.leaderstats.Gems.Value + 10
end
end)
您需要使用可用的值来计算下一次重生的成本。然后,您需要根据这些值更新文本和成本。
script.Parent.MouseButton1Click:Connect(function()
local leaderstats = game.Players.LocalPlayer.leaderstats
local clicks = leaderstats.Clicks
local rebirths = leaderstats.Rebirths
local gems = leaderstats.Gems
local baseRebirthCost = 300
local currentRebirthCost = baseRebirthCost * (2 ^ rebirths.Value)
if clicks.Value < currentRebirthCost then
script.Parent.Text = "Not Enough!"
wait(2)
script.Parent.Text = string.format("1 REBIRTH │ %d CLICKS", currentRebirthCost)
else
rebirths.Value += 1
clicks.Value = 0
gems.Value += 10
end
end)
这将使重生成本相对于重生次数增加:
重生 | 计算 | 成本|
---|---|---|
0 | 300*2^0 | 300 |
1 | 300*2^1 | 600 |
2 | 300*2^2 | 1200 |
3 | 300*2^3 | 2400 |
4 | 300*2^4 | 4800 |
20 | 300*2^20 | 314572800 |