I tried a script and local script but neither worked. It is supposed to change the picture based on how much energy someone has. The energy IntValue changes, "val" in the script. The problem is the picture won't change. Thanks in Advance
local loop = true
local pic = script.Parent
local val = pic.Parent.Parent.Parent.Parent.Parent.EnergyCount
while loop == true do
if val.Value == 0 then
pic.Image = 'rbxassetid://2907865568'
elseif val.Value == 2 then
pic.Image = 'rbxassetid://2907864998'
elseif val.Value == 4 then
pic.Image = 'rbxassetid://2907865057'
elseif val.Value == 6 then
pic.Image = 'rbxassetid://2907865126r'
elseif val.Value == 8 then
pic.Image = 'rbxassetid://2907865169'
elseif val.Value == 10 then
pic.Image = 'rbxassetid://2907865211'
elseif val.Value == 12 then
pic.Image = 'rbxassetid://2907865270'
elseif val.Value == 14 then
pic.Image = 'rbxassetid://2907865317'
elseif val.Value == 16 then
pic.Image = 'rbxassetid://2907865367'
elseif val.Value == 18 then
pic.Image = 'rbxassetid://2907865423'
elseif val.Value == 20 then
pic.Image = 'rbxassetid://2907865470'
elseif val.Value == 22 then
pic.Image = 'rbxassetid://2907865517'
end
end

7 comments
Add a wait inside the loop, your game could crash if you don't, also are the values only supposed to be even? and you dont need the "loop == true" just use "true"
I just have it at different intervals so that their health doesn't go down super quickly
Thx but that didn't work
I'll still keep the wait blocks though so it doesn't crash
couple of things that could be wrong here, #1, you have something else above the image changing code that prevents it from running, #2, you might have an incorrect reference to either the energy count or the pic objects
Either way, I'd suggest using a changed event, as that doesn't prevent code below from running
Speaking of which ^^ can you post an image of your explorer tab?