Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My light isn't flickering like it should?

Asked by 4 years ago

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
0
I’m sending you a friends req on Roblox accept it and we can go into studio together M9F 94 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

0
Hey man I’m going to send you a friends req too. I would like to do a team create challenge. M9F 94 — 4y
0
For? I'm curious Ziffixture 6913 — 4y
0
I like challenging people to script battles to see who get a certain thing done the quickest. It challenges the users and makes them learn new things. M9F 94 — 4y
0
Who can get*^ M9F 94 — 4y
0
Also love learning new things from different players M9F 94 — 4y
Ad

Answer this question