local EMain =game.StarterGui.Energy.Holder.EMain **--here are the variables**
local Bar = game.StarterGui.Energy.Holder.EBar
local UIS = game:GetService("UserInputService")
local Energy = 3
print(Energy)
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
if Energy > 0 then
Energy = Energy - 1
print(Energy)
end
end
end)
while true do
wait()
if Energy == 3 then
Bar.Size = UDim2.new(0, 100, 0, 100) **--change the size**
elseif Energy == 2 then
Bar.Size = UDim2.new(0, 80, 0, 80)
elseif Energy == 1 then
Bar.Size = UDim2.new(0, 60, 0, 60)
elseif Energy == 0 then
Bar.Size = UDim2.new(0, 40, 0, 40)
end
end **--it didn't show any errors so I don't know what went wrong
**
while true do
wait()
if Energy < 3 then
wait(2)
Energy = Energy + 1
print(Energy)
end
end
I tried to loop it but it still didn’t work
New contributor
TRIỆU MINH HOÀNG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.