Script not changing values

My script should change the line thickness and color of a selection box. However, it just doesnt.
I have tried placing prints and everything worked fine except for changing the values…
My code:
lin its the line thickness and col the Color3 of the selection.
dont mind ah and h its health values. (actual health, health)
if ah == h0.9 or ah < h0.9 and ah >h*0.8 then
lin = 0.13
col = Color3.new(0.827451, 1, 0.717647)
else
– more code

If you’re trying to change the value of an instance, you can’t use a variable to reference it.
This is because when you use a variable like this, you do not get a reference to the field (=property), you just get a copy of the current value of the field.
What I think you did:

local col = myObject.Color -- This ISN'T a shortcut to this property, it's just a copy of the value
col = Color3.new(1,1,1)

Here’s what would work:

myObject.Color = Color3.new(1,1,1)
-- or
col = Color3.new(1,1,1)
myObject.Color = col
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.