I want to start with the fact that I started attempting to write scripts less than a week ago, so I expect that this probably happened due to the fact I incorrectly did something, didn’t notice something small or big, or there could be some another issue or my own mistake I’m not aware of.
So, I wanted to script lamp enabling once a boolvalue is checked. The light part would change material to neon and surfacelight in it would get enabled and angle would go from one value to another via tween.
The issue is that nothing changes; not a single property.
Output doesn’t say anything and I do not understand whats wrong.
This is the script
Sorry in case its something simple that I didn’t notice myself.
You’re only checking if the A1Lamp1Power is true 1 time when the script loads in. Use GetPropertyChangedSignal(), which fires every time the specified property changes in an instance:
values.A1Lamp1Power:GetPropertyChangedSignal("Value"):Connect(function()
enable()
end
Changed is for detecting any property change in the instance while GetPropertyChangedSignal() listens to one specific property. So in this case, GetPropertyChangedSignal() would be the best option to use.
That would normally be the case but since we’re working with value objects the ‘Changed’ event/signal behaves differently. https://developer.roblox.com/en-us/api-reference/event/IntValue/Changed
It only fires when the ‘Value’ property changes and it passes its new value to any connected callback functions.