Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- first you need a flashlight part in replicatedstorage.
- -- if you don't then create it.
- -- after creating put a local script in StarterPlayer > StarterCharacterScripts, and open it, then type this script:
- local Camera = workspace.CurrentCamera
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local RunService = game:GetService("RunService")
- local Flashlight = ReplicatedStorage.Flashlight
- local Clone = Flashlight:Clone()
- local TS = game:GetService("TweenService")
- local Sound = script.Parent:WaitForChild("Sound1") -- you need a your custom enabling/disabling flashlight sound!!! OR NOTHING WILL WORK, and you need name sound to Sound1
- Clone.Parent = script.Parent
- local Brightness = 10 -- you can customize that number, that number will be brightness of flashlight.
- local UIS = game:GetService("UserInputService")
- local Mouse = game.Players.LocalPlayer:GetMouse()
- UIS.InputBegan:Connect(function(Input, gpe)
- if gpe then return end
- if Input.KeyCode == Enum.KeyCode.F then
- Clone.SurfaceLight.Enabled = not Clone.SurfaceLight.Enabled
- end
- end)
- RunService.RenderStepped:Connect(function()
- if Clone then
- Clone.Position = Camera.CFrame.Position
- TS:Create(Clone, TweenInfo.new(0.1, Enum.EasingStyle.Quad), {CFrame = CFrame.lookAt(Clone.Position, Mouse.Hit.Position)}):Play()
- if Clone.SurfaceLight.Enabled then
- TS:Create(Clone.SurfaceLight, TweenInfo.new(0.1, Enum.EasingStyle.Quad), {Brightness = Brightness}):Play()
- Sound:Play()
- else
- TS:Create(Clone.SurfaceLight, TweenInfo.new(0.1, Enum.EasingStyle.Quad), {Brightness = 0}):Play()
- Sound:Play()
- end
- end
- end)
- -- if something not working DM ME IN DISCORD!!! Name: noonie2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement