| |
|
| |
|
| |
|
| |
|
|
| 06 Jul 2013 03:04 AM |
You can't click on a spotlight. Also, remember what I said about the Wiki? If you've tried to read it at all, you'd know that you're calling the function wrong. Anyway, you need to have the spotlight inside of a part, then place the following script inside the part alongside of the spotlight. To enable clicking detection, you need a click detector alongside them as well. It should look like this:
-Part ---SpotLight ---Script ---ClickDetector
Here's the script: script.Parent.ClickDetector.MouseClick:connect(function() script.Parent.SpotLight.Enabled = not script.Parent.SpotLight.Enabled wait(.5) script.Parent.SpotLight.Enabled = not script.Parent.SpotLight.Enabled end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Jul 2013 03:16 AM |
Ah, okay. So make sure that the script is inside of a part with the click detector. The spotlight should remain in Workspace.Truck.Lights.LeftHeadlight. I'm going to go one step ahead and assume that you're trying to make the light blink when clicking on it. Here's the script:
Toggle = false
script.Parent.ClickDetector.MouseClick:connect(function() if not Toggle then Toggle = true while Toggle do Workspace.Truck.Lights.LeftHeadlight.SpotLight.Enabled = true wait(.5) Workspace.Truck.Lights.LeftHeadlight.SpotLight.Enabled = false end else Toggle = false Workspace.Truck.Lights.LeftHeadlight.SpotLight.Enabled = false end)
What my script does is when you click on the button while the light isn't blinking, it will start blinking; if the light is blinking, then it will be turned off. Another important thing, case sensitivity is important in scripting. Notice how you had it as "enabled"? That won't work since it's actually "Enabled". |
|
|
| Report Abuse |
|
|
| |
|
| |
|