-- Mana increase script.
mana.Changed:Connect(function()
while mana.Value < manac.Value do -- Manac is the capacity of mana one can have.
wait(4)
mana.Value = mana.Value + 10
end
if mana.Value > manac.Value then
mana.Value = manac.Value
end
-- Basically a textbutton that increases exp and decreases mana when clicked, in the form of a remote event
game.Players.PlayerAdded:Connect(function(player)
game.ReplicatedStorage.ExpUp.OnServerEvent:Connect(function()
local exp = player:WaitForChild("Leaderstats")["Exp"]
local mana = player:WaitForChild("Mana")
local manac = player:WaitForChild("Manac")
if mana.Value >= 5 then
exp.Value = exp.Value + 20
mana.Value = mana.Value - 10
end
end)
end)

1 comment
Basically, whats going on is, every time I click the button, it adds on a new command to increase the mana every 4 seconds, and I only want this command to be done once.