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

How do i add dynamic lighting to a gun?

Asked by 10 years ago

How do i add dynamic lighting when you fire the gun?

2 answers

Log in to vote
0
Answered by 10 years ago
local light = game.Workspace.PointLight:Clone() --Put all of this code in the script when it fires.
light.Parent = script.Parent.GUNSHOOTER
wait(HOW LONG YOU WANT IT TO SAY LIGHT) --Also you may have to edit the caps words
script.Parent.GUNSHOOTER.PointLight:Destroy()

This clones the PointLight from Workspace. And then puts it into the Gunshooter of the gun, and then waits for how long you want it to stay that light, and then destroys the light.

An example gun that you could use is : Hyperlaser gun

Ad
Log in to vote
0
Answered by 10 years ago

I can't give you an exact answer, because it varies between each gun, however you make it.

I can give you the basics however.

So you would want to create a function, that fires when the player shoots the gun. After that you could do something like this:

local flashpart = script.Parent.Barrel -- change this to whatever part you would want to flash 

flash = Instance.new("PointLight") 
flash.Parent = flashpart
wait(0.2)
flash:Destroy()

Hope I helped :)

0
Thank you cedarpointguy97 0 — 10y

Answer this question