i want it to add values to the energy value but it doesnt add
local tool = script.Parent
player = game.Players:GetPlayerFromCharacter(tool.Parent)
tool.Equipped:connect(function(Mouse)
player = game.Players:GetPlayerFromCharacter(tool.Parent)
local energy = player.PlayerGui.ScreenGui.Frame.Frame.Energy
Mouse.Button1Down:connect(function()
if energy.Value ~= 0 then
energy.Value = energy.Value - 10
end
end)
if energy.Value ~=100 then
while true do
energy.Value = energy.Value +1
wait()
end
end
end)

1 comment
You put a while true do statement, which will cause the energy to infinitely grow, since you've never broken the loop. Just saying as a little hint, for future reference.