|
| 15 Aug 2016 09:46 PM |
Changing materials by time of day, at 6AM it's neon and at 8PM it's Smooth Plastic
Please debug:
modelL = script.Parent.WindowLightning allChildren = modelL.GetChildren()
while true do if allChildren.Material then if game.Lightning.GetHoursAfterMidnight() == 6 * 60 then modelL.allChildren.Material.new = "Neon" end end if allChildren.Material then if game.Lightning.GetHoursAfterMidnight() == 20 * 60 then modelL.allChildren.Material.new = "Smooth Plastic" end end end |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:11 PM |
modelL = script.Parent.WindowLightning allChildren = modelL:GetChildren()
while true do if allChildren.Material then if game.Lightning.GetHoursAfterMidnight() == 6 * 60 then allChildren.Material.new = "Neon" end end if allChildren.Material then if game.Lightning.GetHoursAfterMidnight() == 20 * 60 then allChildren.Material.new = "Smooth Plastic" end end end
nothin' like a good argument ¯\_(ツ)_/¯ |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:20 PM |
I fixed the : but it still won't work |
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 15 Aug 2016 10:20 PM |
Remember, when you call :GetChildren() it returns a TABLE of all the children.
so to go through each part and change the material do this: for i,v in pairs (model:GetChildren()) do if game.Lightning.GetHoursAfterMidnight() == 6 * 60 then v.Material = Enum.Material.Neon elseif game.Lightning.GetHoursAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 15 Aug 2016 10:21 PM |
for i,v in next, model:GetChildren() do v.Material = Enum.Material.Neon end
|
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:26 PM |
| I looked for "in pairs" or "child in pairs" on the Wiki, no results that I found useful. What is it? |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:28 PM |
And still not working? model = script.Parent
for i,v in pairs (model:GetChildren()) do if game.Lightning.GetHoursAfterMidnight() == 6 * 60 then v.Material = Enum.Material.Neon elseif game.Lightning.GetHoursAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:37 PM |
Updated:
model = script.Parent
for i,v in pairs (model:GetChildren()) do if game.Lightning.GetHoursAfterMidnight() == 6 * 60 then if v:IsA("BasePart") then v.Material = Enum.Material.Neon elseif game.Lightning.GetHoursAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end end |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 15 Aug 2016 10:39 PM |
game.Lightning kek
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
| |
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 15 Aug 2016 10:42 PM |
"game.Lightning"
game.Lighting*
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:44 PM |
Fixed that... Still not working? model = script.Parent
for i,v in pairs (model:GetChildren()) do if game.Lighting.GetHoursAfterMidnight() == 6 * 60 then if v:IsA("BasePart") then v.Material = Enum.Material.Neon elseif game.Lighting.GetHoursAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end end |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 15 Aug 2016 10:44 PM |
1) "GetHoursAfterMidnight" that doesn't exist 2) even if you were attempting to get hours after midnight, why would you be multiplying by 60 anyway
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 15 Aug 2016 10:45 PM |
and it's also a function, are you even using the wiki/output?
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:50 PM |
Using both to make: modelL = script.Parent.WindowLightning allChildren = modelL.GetChildren()
while true do if allChildren.Material then if game.Lightning.GetHoursAfterMidnight() == 6 * 60 then modelL.allChildren.Material.new = "Neon" end end if allChildren.Material then if game.Lightning.GetHoursAfterMidnight() == 20 * 60 then modelL.allChildren.Material.new = "Smooth Plastic" end end end
which failed and BTW GetHoursAfterMidnight does exist: http://wiki.roblox.com/index.php?title=Making_a_Day/Night_Cycle Last script includes it. |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 15 Aug 2016 10:51 PM |
that's GetMinutesAfterMidnight anyway for some reason you're calling functions as constructors and you're back to game.Lightning and you're trying to set the material of a table and a lot of other things
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:53 PM |
Oh sorry. :)
I'm new to Lua, just started like a week ago.
And above was my old script. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:54 PM |
Updated and still not working:
model = script.Parent
for i,v in pairs (model:GetChildren()) do if game.Lighting.GetMinutesAfterMidnight() == 6 * 60 then if v:IsA("BasePart") then v.Material = Enum.Material.Neon elseif game.Lighting.GetMinutesAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end end |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 10:54 PM |
| *Actually I don't know when I started, but I know it was later in the summer |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 15 Aug 2016 10:56 PM |
call GetMinutesAfterMidnight with a colon not a period
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 11:00 PM |
Hm, not working still?
model = script.Parent
for i,v in pairs (model:GetChildren()) do if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then if v:IsA("BasePart") then v.Material = Enum.Material.Neon elseif game.Lighting:GetMinutesAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end end |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2016 11:11 PM |
Update:
model = script.Parent
for i,v in pairs (model:GetChildren()) do if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then if v:IsA("BasePart", "Union") then v.Material = Enum.Material.Neon elseif game.Lighting:GetMinutesAfterMidnight() == 20 * 60 then v.Material = Enum.Material.SmoothPlastic end end end
Doesn't work |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Aug 2016 11:13 AM |
| The output doesn't read any error messages, yet it doesn't work. |
|
|
| Report Abuse |
|
|
| |
|