script:
01 | local light = Instance.new( 'SurfaceLight' ) |
02 | local humanoidrootpart = script.Parent:WaitForChild( "HumanoidRootPart" ) |
03 |
04 |
05 | repeat wait() until game.Players.LocalPlayer |
06 |
07 |
08 | local humanoidrootpart = game.Players.LocalPlayer.character:WaitForChild( "HumanoidRootPart" ) |
09 | local mouse = game.Players.LocalPlayer:GetMouse() |
10 | light.Parent = humanoidrootpart |
11 | light.Brightness = 0 |
12 |
13 |
14 | mouse.KeyDown:connect( function (key) |
15 | if key = = "f" then |
Put the below in a localscript
01 | local Mouse = game.Players.LocalPlayer:GetMouse() |
02 | local on = false |
03 | local pointLight = script.Parent.FlashLightHead.PointLight |
04 | --set pointLight to the location of the PointLight that controls the flashlight's light |
05 | Mouse.Button 1 Down:Connect( function () |
06 | if on then |
07 | on = false |
08 | pointLight.Range = 0 |
09 | else |
10 | on = true |
11 | pointLight.Range = 8 |
12 | end |
13 | end |
Try MouseClick