|
| 04 Dec 2013 06:42 AM |
while true do wait(1) game.Workspace.lights.lights1.PointLight.Enabled = true wait(1) game.Workspace.lights.lights1.PointLight.Enabled=false game.Workspace.lights.lights2.PointLight.Enabled=true wait(1) game.Workspace.lights.lights2.PointLight.Enabled=false game.Workspace.lights.lights3.PointLight.Enabled=true wait(1) game.Workspace.lights.lights3.PointLight.Enabled=false game.Workspace.lights.lights4.PointLight.Enabled=true wait(1) game.Workspace.lights.lights4.PointLight.Enabled=false game.Workspace.lights.lights5.PointLight.Enabled=true wait(1) game.Workspace.lights.lights5.PointLight.Enabled=true end
It says that PointLight is not a valid member of Part, yet I've located all the lights() correctly. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 06:53 AM |
You cannot have a number be in the name of whatever you're trying to index (index == locate)
For an inex.; game.Workspace.lights.lights1.PointLight.Enabled = false -- This WON'T work, simply because you'll need brackets and apostraphes or you can use quotation marks if you wish.
For an ex; game.Workspace.lights['lights1'].PointLight.Enabled = true -- This would be the correct way to do so. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 06:54 AM |
| Thank you, I never knew that. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 06:58 AM |
| That's still not the problem. I've clearly located what I want done to PointLight. Though, the output says something about PointLight is not a valid member of Part? |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 04 Dec 2013 07:00 AM |
| Put pointlight named PointLight in the light 1, 2, etc. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 07:22 AM |
| What do you mean? Re-name PointLight to pointlight? |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 Dec 2013 07:36 AM |
| No, you have have numbers in what you're indexing; however, you cannot index a name with a preceding number. For instance, 'Workspace.1Part' would error. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 Dec 2013 07:37 AM |
The way to fix this error is to used some sort of string-based indexing, e.g.:
Workspace['1Part'].Part['2Part']:Destroy() Workspace:findFirstChild('1Part'):Destroy() |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 03:06 PM |
I get what you guys are saying. It just still doesn't work.
while true do wait(1) game.Workspace.lights['lights1'].PointLight.Enabled = true wait(1) game.Workspace.lights['lights1'].PointLight.Enabled=false game.Workspace.lights['lights2'].PointLight.Enabled=true wait(1) game.Workspace.lights['lights2'].PointLight.Enabled=false game.Workspace.lights['lights3'].PointLight.Enabled=true wait(1) game.Workspace.lights['lights3'].PointLight.Enabled=false game.Workspace.lights['lights4'].PointLight.Enabled=true wait(1) game.Workspace.lights['lights4'].PointLight.Enabled=false game.Workspace.lights['lights5'].PointLight.Enabled=true wait(1) game.Workspace.lights['lights5'].PointLight.Enabled=true end
|
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 03:13 PM |
l = game.Workspace.lights
while wait(1)do l.lights5.PointLight.Enabled = false l.lights1.PointLight.Enabled = true wait(1) l.lights1.PointLight.Enabled = false l.lights2.PointLight.Enabled = true wait(1) l.lights2.PointLight.Enabled = false l.lights3.PointLight.Enabled = true wait(1) l.lights3.PointLight.Enabled = false l.lights4.PointLight.Enabled = true wait(1) l.lights4.PointLight.Enabled = false l.lights5.PointLight.Enabled = true wait(1) l.lights5.PointLight.Enabled = true end
this script is just okay check output i think you have error in names make sure names are correct |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 03:43 PM |
| I have spelt all the names correctly. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 Dec 2013 03:54 PM |
| Take a picture of the hierarchy as shown in the Explorer and upload it to Imgur or a preferred site. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 06:00 PM |
| All I have done is located "lights" -which is a group- then located the lights inside the group, then I finally located the pointlight. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 06:35 PM |
This one too does not work:
while true do wait(1) game.Workspace.lights['lights1']['PointLight'].Enabled = true wait(1) game.Workspace.lights['lights1']['PointLight'].Enabled=false game.Workspace.lights['lights2']['PointLight'].Enabled=true wait(1) game.Workspace.lights['lights2']['PointLight'].Enabled=false game.Workspace.lights['lights3']['PointLight'].Enabled=true wait(1) game.Workspace.lights['lights3']['PointLight'].Enabled=false game.Workspace.lights['lights4']['PointLight'].Enabled=true wait(1) game.Workspace.lights['lights4']['PointLight'].Enabled=false game.Workspace.lights['lights5']['PointLight'].Enabled=true wait(1) game.Workspace.lights['lights5']['PointLight'].Enabled=true end
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Dec 2013 06:37 PM |
| That means "PointLight" does not exist in one of the lights["lightsX"] |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 06:36 AM |
| I have checked everything; they're all there. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 05 Dec 2013 07:32 AM |
| Mother of God, show us your hierarchy if you want to be helped! |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 05 Dec 2013 08:15 AM |
if game ~= nil then print("Game ok!") if game.Workspace ~= nil then print("Workspace ok!") if game.Workspace.lights ~= nil then print("Lights ok!") if game.Workspace.lights.lights1 ~= nil then print("Lights that might be called ligh accidenly ok") if game.Workspace.lights.lights1.PointLight ~= nil then print("PointLight ok!")
show us the output.
|
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 10:40 AM |
try this
--NOTE: rename pointlights to 'pl' for shorter more simple code. also rename the parts to have a 'x' at the end after the number gw=game.Workspace l=gw.lights while true do wait(1) l.light1x.pl.Enabled=true wait(1) l.light1x.pl.Enabled=false l.light2x.pl.Enabled=true wait(1) l.light2x.pl.Enabled=false l.light3x.pl.Enabled=true wait(1) l.light3x.pl.Enabled=false l.light4x.pl.Enabled=true wait(1) l.light4x.pl.Enabled=false l.light5x.pl.Enabled=true end |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 01:38 PM |
say, don't you need to put a wait() between the game.Workspace.lights.lights1.PointLight.Enabled=false and game.Workspace.lights.lights2.PointLight.Enabled=true lines?
else it would just skip to PointLight.Enabled=true everytime since PointLight.Enabled=false wouldn't have enough wait() time to execute. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 06:46 PM |
| If I wanted a wait(?) that'd mean I would want to delay. Since I don't want to delay, I put no waits. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 06:49 PM |
'say, don't you need to put a wait() between the game.Workspace.lights.lights1.PointLight.Enabled=false and game.Workspace.lights.lights2.PointLight.Enabled=true lines?'
That's what I've been thinking the entire time I've been reading the replies to this post. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 10:31 PM |
no, no. you can also put a wait(0) between the game.Workspace.lights.lights1.PointLight.Enabled=false and game.Workspace.lights.lights2.PointLight.Enabled=true. a wait(0) is a VERY SHORT delay, short enough to make your lights "move" smoothly. no wait(0) means, like i said before, will just skip directly to game.Workspace.lights.lights2.PointLight.Enabled=true. |
|
|
| Report Abuse |
|
|
BetterBe
|
  |
| Joined: 25 Jan 2009 |
| Total Posts: 1034 |
|
|
| 05 Dec 2013 10:34 PM |
| maybe if you didn't neglect the script and changed its cage every once in a while it would work for you. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2013 10:53 PM |
nnnnngggggggggh....!! my friend has failed me! he told me that it would just skip to the last unwaited code without executing the other unwaited code.
sorry about that.
i'm gonna tutor myself from now on. |
|
|
| Report Abuse |
|
|