|
| 11 May 2017 11:29 AM |
lamp=script.Parent white=lamp.PointLight red=lamp.SpotLight
function SwitchToRed() wait(.01) white.Enabled=false red.Enabled=true lamp.BrickColor=BrickColor.new'Bright red' end
function SwitchToWhite() wait(.01) white.Enabled=true red.Enabled=false lamp.BrickColor=BrickColor.new'White' end
emergency=game.Lighting.Emergency
wait(.1) emergency.Value.Changed:connect(function(newvalue) if newvalue==true then SwitchToRed() elseif newvalue==false then SwitchToWhite() end
|
|
|
| Report Abuse |
|
|
Calviski
|
  |
| Joined: 03 Dec 2016 |
| Total Posts: 209 |
|
|
| 11 May 2017 11:30 AM |
lamp=script.Parent white=lamp.PointLight red=lamp.SpotLight
is meant to be
lamp = script.Parent white = lamp.PointLight red = lamp.SpotLight |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 11:31 AM |
Er.. spacing doesn't have anything to do with it. What's the actual problem?
|
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 11 May 2017 11:33 AM |
"What's the actual problem?"
we could just ask you the same question
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 11:36 AM |
lamp.BrickColor=BrickColor.new'White' You need brackets lamp.BrickColor=BrickColor.new('White') |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 11:36 AM |
I don't know, Intern. I checked Output and all it gave was 'add an extra end' so here is the updated script (still not working for some reason). Is it a problem with the functions or the Changed?
lamp=script.Parent white=lamp.PointLight red=lamp.SpotLight
function SwitchToRed() wait(.01) white.Enabled=false red.Enabled=true lamp.BrickColor=BrickColor.new'Bright red' end
function SwitchToWhite() wait(.01) white.Enabled=true red.Enabled=false lamp.BrickColor=BrickColor.new'White' end
emergency=game.Lighting.Emergency
wait(.1) emergency.Value.Changed:connect(function(newvalue) if newvalue==true then SwitchToRed() elseif newvalue==false then SwitchToWhite() end
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 11:38 AM |
Brackets has nothing to do with it... and neither does spacing. Why do you guys keep suggesting things about formatting? There's clearly an issue with the actual script.
Forget it. I'll find out the problem myself. >.<
|
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 11 May 2017 11:38 AM |
1st you dont need brackets, function"string argument" is fine
2nd,
emergency.Value.Changed:connect(function(newvalue) ... end
dont you see anything?
:connect(function(newvalue)
you have an opening bracket
the last end should be
end)
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 11:45 AM |
Thanks Intern. Glad someone knows how to script around here... BUT...
{...} wait(.1) emergency.Value.Changed:connect(function(newvalue) if newvalue==true then SwitchToRed() elseif newvalue==false then SwitchToWhite() end end)
Still doesn't work when I go in Play Solo and switch the Emergency value on and off.
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 12:07 PM |
View > Output
Look for errors. |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 12:15 PM |
Nope.. still can't find a problem and I've tried around three different scripts.
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 May 2017 12:50 PM |
emergency..Changed:connect(function(newvalue) if newvalue==true then SwitchToRed() elseif newvalue==false then SwitchToWhite() end end)
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 May 2017 12:50 PM |
| Oops take out one of the dots after emergency |
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 May 2017 12:51 PM |
or do this
emergency:GetPropertyChangedSignal("Value"):connect(function(newvalue)
if newvalue==true then SwitchToRed() elseif newvalue==false then SwitchToWhite() end
end)
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 12:55 PM |
@devHoodie:
Just tried that and it's still broken! D: Here is a gyo link to show you the issue:
bcd7eb52655e4eb52d084a15e012a598
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 May 2017 12:56 PM |
emergency:GetPropertyChangedSignal("Value"):connect(function()
if Emergency.Value == true then SwitchToRed() else SwitchToWhite() end
end)
i suggest you put emergency into ServerStorage |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 01:04 PM |
Nope. Still broken. Seriously, why is this so hard to script for god's sake? Not directed to you or anything but all this is is making the brick do something when a value is set to true or false. ><
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 May 2017 01:05 PM |
| Are you getting any errors? |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 01:54 PM |
'Thanks Intern. Glad someone knows how to script around here'
If you're such a good scripter why don't you do it yourself? |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 01:56 PM |
I'm not a good scripter.. that's why I'm asking for help ><
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 01:57 PM |
| So why are you assuming the people who tried to help can't script ^-^? |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 01:59 PM |
emergency=game.Lighting.Emergency
wait(.1) emergency.Changed:connect(function() print "Checking if changed" if emergency.Value==true then SwitchToRed() elseifemergency.Value==false then SwitchToWhite() end end)
Try it |
|
|
| Report Abuse |
|
|
|
| 11 May 2017 02:06 PM |
@Inedible:
Thank you!
Sorry if it came out wrong too lol. I meant in reference to the people who were literally suggesting "change the brackets and speech marks". I get them every scripting help thread I post (which I rarely do post) >_<
Ty again ^_^
|
|
|
| Report Abuse |
|
|
|
| 11 May 2017 02:26 PM |
| Welcomez sorry for coming off rude I thought you had to have the brackets lmao |
|
|
| Report Abuse |
|
|