Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 10:58 PM |
print 'Glowing Light Effect Loaded' Orbs = script.Parent.Orbs1, script.Parent.Orbs2, script.Parent.Orbs3, script.Parent.Orbs4, script.Parent.Orbs5, script.Parent.Orbs6, script.Parent.Orbs7, script.Parent.Orbs8, script.Parent.Orbs9, script.Parent.Orbs10, script.Parent.Orbs11, script.Parent.Orbs12, script.Parent.Orbs13, script.Parent.Orbs14, script.Parent.Orbs15, script.Parent.Orbs16, script.Parent.Orbs17, script.Parent.Orbs18, script.Parent.Orbs19, script.Parent.Orbs20, script.Parent.Orbs21, script.Parent.Orbs22, script.Parent.Orbs23, script.Parent.Orbs while true do Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.7) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.9) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.6) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.7) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.9) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.6) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(1) end
This script is meant to increase the range of the point light of the bricks specified as Orbs, but it only does this to Orbs1. Can someone fix this for me? |
|
|
| Report Abuse |
|
|
|
| 27 Aug 2013 11:03 PM |
coroutines and tables Well. Actually idk if this'll work.
print 'Glowing Light Effect Loaded' Orb = {script.Parent.Orbs1, script.Parent.Orbs2, script.Parent.Orbs3, script.Parent.Orbs4, script.Parent.Orbs5, script.Parent.Orbs6, script.Parent.Orbs7, script.Parent.Orbs8, script.Parent.Orbs9, script.Parent.Orbs10, script.Parent.Orbs11, script.Parent.Orbs12, script.Parent.Orbs13, script.Parent.Orbs14, script.Parent.Orbs15, script.Parent.Orbs16, script.Parent.Orbs17, script.Parent.Orbs18, script.Parent.Orbs19, script.Parent.Orbs20, script.Parent.Orbs21, script.Parent.Orbs22, script.Parent.Orbs23, script.Parent.Orbs} for i = 1,#Orb do coroutine.resume(coroutine.create(function() Orbs = Orb[i] while true do Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.7) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.9) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.6) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.7) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.9) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.6) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(1) end)) wait() end end |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:09 PM |
00:08:13.374 - Workspace.Model.Model.Script:27: unexpected symbol near ')'
It questions " end))" |
|
|
| Report Abuse |
|
|
|
| 27 Aug 2013 11:13 PM |
My bad... misplaced end
print 'Glowing Light Effect Loaded' Orb = {script.Parent.Orbs1, script.Parent.Orbs2, script.Parent.Orbs3, script.Parent.Orbs4, script.Parent.Orbs5, script.Parent.Orbs6, script.Parent.Orbs7, script.Parent.Orbs8, script.Parent.Orbs9, script.Parent.Orbs10, script.Parent.Orbs11, script.Parent.Orbs12, script.Parent.Orbs13, script.Parent.Orbs14, script.Parent.Orbs15, script.Parent.Orbs16, script.Parent.Orbs17, script.Parent.Orbs18, script.Parent.Orbs19, script.Parent.Orbs20, script.Parent.Orbs21, script.Parent.Orbs22, script.Parent.Orbs23, script.Parent.Orbs} for i = 1,#Orb do coroutine.resume(coroutine.create(function() Orbs = Orb[i] while true do Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.7) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.9) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(.6) Orbs.PointLight.Range = Orbs.PointLight.Range + 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(1) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.7) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.9) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(.6) Orbs.PointLight.Range = Orbs.PointLight.Range - 1 wait(1) end end)) wait() end |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:13 PM |
Tell me if this works:
print 'Glowing Light Effect Loaded' local lowerRange = 10 -- Change to whatever local upperRange = 20 -- Change to whatever local numOrbs = 23 -- Change to however many orbs you have ('Orbs' will also be iterated through) local waitTime = 0.1 -- Also can change
while true do for i = lowerRange,upperRange do for _,v in pairs(script.Parent:GetChildren()) do local orbNum = tonumber(v.Name:sub(5)) if v.Name:sub(1,4) == "Orbs" and (not orbNum) or orbNum <= numOrbs then v.Range = i end end wait(waitTime) end for i = upperRange,lowerRange,-1 do for _,v in pairs(script.Parent:GetChildren()) do local orbNum = tonumber(v.Name:sub(5)) if v.Name:sub(1,4) == "Orbs" and (not orbNum) or orbNum <= numOrbs then v.Range = i end end wait(waitTime) end end
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:17 PM |
| I fixed that but the script just increase all of the orbs range by 1 and stops. |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:19 PM |
Did... did you even read my post?
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:24 PM |
I just did. and the Output says 00:21:38.951 - Range is not a valid member of Part 00:21:38.952 - Script 'Workspace.Model.Model.Script', Line 12 00:21:38.952 - stack end I'm assuming it needs to counts the number of pointlights? |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:25 PM |
Nope, just a silly error on my part
print 'Glowing Light Effect Loaded' local lowerRange = 10 -- Change to whatever local upperRange = 20 -- Change to whatever local numOrbs = 23 -- Change to however many orbs you have ('Orbs' will also be iterated through) local waitTime = 0.1 -- Also can change
while true do for i = lowerRange,upperRange do for _,v in pairs(script.Parent:GetChildren()) do local orbNum = tonumber(v.Name:sub(5)) if v.Name:sub(1,4) == "Orbs" and (not orbNum) or orbNum <= numOrbs then v.PointLight.Range = i end end wait(waitTime) end for i = upperRange,lowerRange,-1 do for _,v in pairs(script.Parent:GetChildren()) do local orbNum = tonumber(v.Name:sub(5)) if v.Name:sub(1,4) == "Orbs" and (not orbNum) or orbNum <= numOrbs then v.PointLight.Range = i end end wait(waitTime) end end
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:26 PM |
00:26:00.671 - PointLight is not a valid member of Part 00:26:00.671 - Script 'Workspace.Model.Model.Script', Line 12 00:26:00.671 - stack end
Same Output. |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:28 PM |
| Funny that you made that fix. I made the same fix while reading your first post. |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:30 PM |
Make sure you don't have any parts named 'Orbs' anything without a pointlight in them named 'PointLight'
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:36 PM |
Okay all that is done. 00:35:52.995 - Workspace.Model.Model.Script:11: attempt to compare nil with number 00:35:52.995 - Script 'Workspace.Model.Model.Script', Line 11 00:35:52.996 - stack end
if v.Name:sub(1,4) == "Orbs" and (not orbNum) or orbNum <= numOrbs then This line. |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:43 PM |
This is why you always test code before posting it, children :/
if v.Name:sub(1,4) == "Orbs" and (orbNum == nil or orbNum <= numOrbs) then
Try that?
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:44 PM |
Replace both lines, of course.
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 27 Aug 2013 11:46 PM |
| It works perfectly now it's beautiful. Thank you. |
|
|
| Report Abuse |
|
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 27 Aug 2013 11:50 PM |
Yay! I can sleep now :D
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|