I've tried putting this script inside a fire object using the boolvalue "flareson"
1 | if game.workspace.flareson.value = true |
2 | then script.Parent.Enabled = true |
3 | else script.Parent.Enable = false |
but the fire object is on, even though flareson's value property is unchecked.
To constantly sense the status of an object, do this:
1 | game.Workspace:WaitForChild( "flareson" ).Changed:Connect( function (IsOn) --IsOn will return as the value of the flare |
2 | script.Parent.Enabled = IsOn |
3 | end ) |
Short and sweet. With further questions/comments/concerns, feel free to reply. Happy scripting! ~mc3334
your syntax is wrong it should be
1 | function flareson() |
2 | if game.Workspace.flareson.Value = = true then |
3 | script.Parent.Enabled = true |
4 | else |
5 | script.Parent.Enabled = false |
6 | end |
7 | end |
you need two equal signs when comparing values in an if statement, only one is needed when setting/changing values