someone help me, i am doing a game like capybara evolution, normally when i break a block i earn 1 win, but when i break a block after a rebirth i earn 10 wins(rebirth havent use), and it just happen one time
i am gonna show the code
block code:
local part = script.Parent
local clickDetector = part:WaitForChild("ClickDetector")
local blocolife = 100
local bbg = part:FindFirstChild("BillboardGui")
local bbgtx = bbg and bbg:FindFirstChild("TextLabel")
bbgtx.Text = tostring(blocolife)
part:FindFirstChild("ClickDetector").MouseClick:Connect(function(player)
print (player.Name.."clicou no botão")
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then
warn("Leaderstats não encontrados para", player.Name)
return
end
local power = leaderstats:FindFirstChild("power")
if not power then
warn("Power não encontrado")
return
end
local money = leaderstats:FindFirstChild("money")
if not money then
warn ("money nao encontrado")
return
end
print (power.Value)
blocolife = blocolife - power.Value
if bbgtx then
bbgtx.Text = tostring(blocolife)
end
if blocolife <= 0 then
money.Value = money.Value +1
part.Position = Vector3.new(-20, -10, 9)
bbg.Enabled = false
wait(3)
bbg.Enabled = true
part.Position = Vector3.new(-20, 2, 9)
blocolife = 100
bbgtx.Text = tostring(blocolife)
end
end)``
```lua
rebirth code:
local players = game:GetService("Players")
local player = players.LocalPlayer
local statss = player:FindFirstChild("leaderstats")
local rebirth = statss:FindFirstChild("rebirth")
local money = statss:FindFirstChild("money")
script.Parent.Activated:Connect(function()
if money.Value >=10 then
rebirth.Value +=1
money.Value -=10
end
end)```