|
| 03 Nov 2016 03:41 PM |
I have a script that constantly checks for a value. If it is 3 it makes itself transparent, and if its 0 it makes itself visible. It's not functioning, so can someone fix it?
while true do
wait(1) if game.Workspace["Current Color"].Value == 3 then script.Parent.Transparency = 1 script.Parent.CanCollide = false
elseif game.Workspace["Current Color"].Value == 0 then
script.Parent.Transparency = 0 script.Parent.CanCollide = true
end end |
|
|
| Report Abuse |
|
|
SurKipper
|
  |
| Joined: 25 Dec 2011 |
| Total Posts: 435 |
|
|
| 03 Nov 2016 04:08 PM |
any errors in the console?
in the top of the screen
View > Output
just in case |
|
|
| Report Abuse |
|
|
yankana
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 431 |
|
|
| 03 Nov 2016 04:13 PM |
Use the 'Changed'-event instead. It's more efficient.
game.Workspace["Current Color"].Changed:connect(function(value) if value == 3 then script.Parent.Transparency = 1 script.Parent.CanCollide = false elseif value == 0 then script.Parent.Transparency = 0 script.Parent.CanCollide = true end end |
|
|
| Report Abuse |
|
|
yankana
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 431 |
|
|
| 03 Nov 2016 04:14 PM |
| ^ Forgot the ) at the end. Console will tell you anyways. |
|
|
| Report Abuse |
|
|