Hey guys, I was wondering how do you make it so a certain light on a gun (script.Parent.Light.Light1) is enabled when you hit f, and disabled when you hit it again?
Also is it easy to just copy it if I wanted to make 2 lights in a gun?
You can copy this script, just change the key (Obviously...)
Equipped = false on = false light = script.Parent.PointLight script.Parent.Equipped:connect(function(Equipped) Equipped = true end) mouse.KeyDown:connect(function(key) local key = key:lower() if Equipped and key == "f" and on == false then light.Enabled = true on = true elseif Equipped and key =="f" and on == true then light.Enabled = false on = false end end) --[[script.Parent.Unequipped:connect(function() light.Enabled = false end)--]] --The above is if you want it to auto-set the light off if they put away the tool
-Thank me by accepting this answer/bumping up my reputation!
mouse=Game.Players.LocalPlayer:GetMouse(); light=WHERE_TO_FIND_THE_LIGHT; mouse.KeyDown:connect(function(key) if key:lower()=='f' then light.Enabled=not light.Enabled; end; end);