Hasli4

RBLX. GunScript

May 14th, 2025
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local gun = script.Parent
  2.  
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local remoteEvent = ReplicatedStorage:WaitForChild('ShotEvent')
  5.  
  6. local reload = false
  7. local reload_time = 1
  8.  
  9. local player = game.Players.LocalPlayer
  10. gun.Equipped:Connect(function(mouse)
  11.     player.CameraMode = Enum.CameraMode.LockFirstPerson
  12.     mouse.Button1Down:Connect(function()
  13.         if reload == false then
  14.             remoteEvent:FireServer(gun.Scope.Position, mouse.Hit.p)
  15.             reload = true
  16.             wait(reload_time)
  17.             reload = false
  18.         end
  19.     end)
  20. end)
  21.  
  22. gun.Unequipped:Connect(function()
  23.     player.CameraMode = Enum.CameraMode.Classic
  24. end)
  25.  
Add Comment
Please, Sign In to add comment