script:
local light = Instance.new('SurfaceLight') local humanoidrootpart = script.Parent:WaitForChild("HumanoidRootPart") repeat wait() until game.Players.LocalPlayer local humanoidrootpart = game.Players.LocalPlayer.character:WaitForChild("HumanoidRootPart") local mouse = game.Players.LocalPlayer:GetMouse() light.Parent = humanoidrootpart light.Brightness = 0 mouse.KeyDown:connect(function(key) if key == "f" then script.flashlight_on:Play() light.Brightness = 5 end end) mouse.KeyUp:connect(function(key) if key == "f" then script.flashlight_off:Play() light.Brightness = 0 end end)
Put the below in a localscript
local Mouse = game.Players.LocalPlayer:GetMouse() local on = false local pointLight = script.Parent.FlashLightHead.PointLight --set pointLight to the location of the PointLight that controls the flashlight's light Mouse.Button1Down:Connect(function() if on then on = false pointLight.Range = 0 else on = true pointLight.Range = 8 end end
Try MouseClick