My flashlight Battery GUI doesn't work.
player = script.Parent.Parent.Parent
char = player.Character
battery = script.Battery -- Starts at 100.
light = char.Flashlight.Handle.SpotLight
function batteryLife()
if light.Enabled == true then repeat
wait(1)
battery.Value = battery.Value - 1 -- Goes down by 1 every second.
until battery.Value == 0
end
script.Parent["Battery Frame"].%Battery.%Battery.Value = "Battery:".. battery.Value.. "%"
end
char.Flashlight.Activated:connect(batteryLife)
No part of this script works.
EDIT: Still doesn't work. Is there anything else that can be added/fixed?

2 comments
Oh thanks! This is my first time using repeat. Thanks for clearing this up for me.
I changed my script but it still doesn't work for some reason. Can you think of anything else?