Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Variable cannot be referenced?

Asked by
drew1017 330 Moderation Voter
9 years ago
Energy = Instance.new('NumberValue', Objects)
        Energy.Name = 'Energy'
        Energy.Value = 100
Energy.Changed:connect(function(val)
    EnergyBar.Size = UDim2.new(val / MaxEnergy.Value,0,0,1)
    if val > MaxEnergy.Value then val = MaxEnergy.Value end
end)

Plain and simple, the function isn't triggered when Energy is changed.

2
Are you sure that it isn't triggering, or that the trigger is simply doing nothing? Try adding a print statement. adark 5487 — 9y
0
Print statements are your friend when no errors are present. Try printing the values you are trying to change before and after and she if they are changed. Lets us know what you find. Necrorave 560 — 9y

Answer this question