Advertisement
Guest User

TUTORIAL #1

a guest
Dec 1st, 2022
37,834
1
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | Source Code | 1 0
  1. local cam = workspace.CurrentCamera
  2. local RS = game:GetService("ReplicatedStorage")
  3. local RunService = game:GetService("RunService")
  4. local Flashlight = RS.Flashlight
  5. local Clone = Flashlight:Clone()
  6. Clone.Parent = script.Parent
  7.  
  8. local Brightness = 5
  9.  
  10. local Keybind = Enum.KeyCode.F
  11.  
  12. local UIS = game:GetService("UserInputService")
  13.  
  14. local Toggle = false
  15.  
  16. local Mouse = game.Players.LocalPlayer:GetMouse()
  17.  
  18. local TS = game:GetService("TweenService")
  19. local TI = TweenInfo.new(.1, Enum.EasingStyle.Sine)
  20.  
  21.  
  22. UIS.InputBegan:Connect(function(Input, p)
  23. if p then return end
  24. if Input.KeyCode == Keybind then
  25. Toggle = not Toggle
  26. end
  27. end)
  28.  
  29. RunService.RenderStepped:Connect(function()
  30. if Clone then
  31.  
  32. Clone.Position = cam.CFrame.Position
  33. TS:Create(Clone, TI, {CFrame = CFrame.lookAt(Clone.Position, Mouse.Hit.Position)}):Play()
  34.  
  35. if Toggle then
  36. TS:Create(Clone.SpotLight, TI, {Brightness = Brightness}):Play()
  37.  
  38. else
  39. TS:Create(Clone.SpotLight, TI, {Brightness = 0}):Play()
  40. end
  41.  
  42. end
  43. end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement