嗨,我做了一个重生系统,但是,我怎么每次都加倍


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)

这将使重生成本相对于重生次数增加:

成本
重生计算
0300*2^0300
1300*2^1600
2300*2^21200
3300*2^32400
4300*2^44800
20300*2^20314572800

相关内容

最新更新