HowToRoblox

ShootDetect

May 12th, 2021
630
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local tool = script.Parent
  2. local shootRE = tool:WaitForChild("ShootRE")
  3. local mouseRE = tool:WaitForChild("MouseRE")
  4.  
  5.  
  6. local mouse = game.Players.LocalPlayer:GetMouse()
  7.  
  8.  
  9. mouse.Button1Down:Connect(function()
  10.    
  11.     shootRE:FireServer(true)
  12. end)
  13.  
  14. mouse.Button1Up:Connect(function()
  15.  
  16.     shootRE:FireServer(false)
  17. end)
  18.  
  19.  
  20. game:GetService("RunService").Heartbeat:Connect(function()
  21.    
  22.     mouseRE:FireServer(mouse.Hit, workspace.CurrentCamera.CFrame.Position)
  23. end)
RAW Paste Data