HowToRoblox

GunClient

Nov 22nd, 2020 (edited)
590
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local plr = game.Players.LocalPlayer
  2. local char = plr.Character or plr.CharacterAdded:Wait()
  3.  
  4. local tool = script.Parent
  5.  
  6.  
  7. local idleAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.IdleAnim)
  8. local shootAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.ShootAnim)
  9.  
  10.  
  11. tool.Equipped:Connect(function()
  12.  
  13.     game.ReplicatedStorage.ConnectM6D:FireServer(tool.BodyAttach)
  14.    
  15.     char.UpperTorso.ToolGrip.Part0 = char.UpperTorso
  16.     char.UpperTorso.ToolGrip.Part1 = tool.BodyAttach
  17.    
  18.    
  19.     idleAnim:Play()
  20. end)
  21.  
  22. tool.Unequipped:Connect(function()
  23.  
  24.     game.ReplicatedStorage.DisconnectM6D:FireServer()
  25.    
  26.     idleAnim:Stop()
  27. end)
  28.  
  29.  
  30.  
  31. tool.Activated:Connect(function()
  32.    
  33.     shootAnim:Play()
  34. end)
RAW Paste Data