I want to make a Light that flickers between being on and off. I currently have a Part with a PointLight and a Script inside of it. The Script is not inside the PointLight.
Here is the code:
local LightPart = game.workspace.LightPart local PointLight = game.Workspace.LightPart.PointLight while true do wait(.1) LightPart.Material.Enum = SmoothPlastic PointLight.Enabled = false wait(.1) LightPart.Material.Enum = Neon PointLight.Enabled = true end
Instead of doing (also it helps if you tell what the error is)
local LightPart = game.workspace.LightPart local PointLight = game.Workspace.LightPart.PointLight
You should do this instead.. If I'm incorrect please correct me on this. so basically you have a script inside of that part, if so do this
local LightPart = script.LightPart -- This script is in a part local PointLight = script.Parent.PointLight print ("This works") -- You can remove this if you want
If your script is in a model and not in a part then do this
local LightPart = script.Parent.LightPart -- This script is in a model local PointLight = script.Parent.Parent.PointLight print ("This works") -- You can remove this if you want
You can remove the print() if you want, and if there's something wrong about it please tell me! PLEASE give me the error if something is wrong in my script.
AGAIN If I'm incorrect please correct me on this. So basically you have a script inside of that part