Ok theres no errors in the script that i see but when i go to test it it doesnt work and says this
LightPart is not a valid member of Part
Workspace.Map.TopSide.ParkingLot.ParkingLotLightParts.LightPart
@Jacko_Korbius
@tin_nim
Ok theres no errors in the script that i see but when i go to test it it doesnt work and says this
LightPart is not a valid member of Part
Workspace.Map.TopSide.ParkingLot.ParkingLotLightParts.LightPart
@Jacko_Korbius
@tin_nim
Can you show the explorer tab of your folder, the parts, and the light object itself?
It goes map then topside then parking lot then parking lot light parts then the parts then the spot lights.
Where is your script located? And are all the light parts under âParkinglotLightPartsâ?
Script is located in the Parking lot folder not the light part folder.
Okay so edit your script to this:
local timetoturnon = 7 * 60 --multiply the hour to minute
local timetoturnon = 23*60 --same
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if game.Lighting:GetMinutesAfterMidnight() > timetoturnoff and game.Lighting:GetMinutesAfterMidnight() < timetoturnon then
--so If time is currently after 7 am and before 23 o'clock the light will be off
for _, v in pairs(script.Parent.Parkinglotlightparts:GetChildren()) do
v.SpotLight.Enabled = false
end
else
for _, v in pairs(script.Parent.Parkinglotlightparts:GetChildren()) do
v.SpotLight.Enabled = false
end
end
end)
Where you see âv.SpotLight.Enabledâ is where the error was, you didnât need to have âv.LightPart.Spotlightâ, so we just took out âLightPartâ since v is LightPart.
Edit: Not sure why my formatting isnât working for the code but copy from the first âlocalâ to the last âend)â Edit2: Never mind, got it to work.
Yes!! It finally works i just changed the v.lightpart.spotlight to just v.spotlight and it worked! Thank you so much!
Also this is irrelevant but how did u learn to script?
Hooray!
Donât want to get too off topic here but I learned using the Roblox API Documentation as well as Youtube videos for beginning scripting. This is a pretty good playlist: Alvin Bloxâs beginner scripting tutorials. This is what I used a lot, and there is an advanced tutorial on his channel as well for once you finish the beginner series: TheDevKingâs beginner scripting series.
I wish you the best of luck on learning, have a good one!
How is your scripting journey coming along?