Advertisement
MindOfPlayer

1 punch

Apr 29th, 2020
4,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1.     mainRemotes = game.ReplicatedStorage
  2. meleeRemote = mainRemotes['meleeEvent']
  3. mouse = game.Players.LocalPlayer:GetMouse()
  4. punching = false
  5. cooldown = false
  6.  
  7. function punch()
  8. cooldown = true
  9. local part = Instance.new("Part", game.Players.LocalPlayer.Character)
  10. part.Transparency = 1
  11. part.Size = Vector3.new(5, 2, 3)
  12. part.CanCollide = false
  13. local w1 = Instance.new("Weld", part)
  14. w1.Part0 = game.Players.LocalPlayer.Character.Torso
  15. w1.Part1 = part
  16. w1.C1 = CFrame.new(0,0,2)
  17. part.Touched:connect(function(hit)
  18. if game.Players:FindFirstChild(hit.Parent.Name) then
  19. local plr = game.Players:FindFirstChild(hit.Parent.Name)
  20. if plr.Name ~= game.Players.LocalPlayer.Name then
  21. part:Destroy()
  22.  
  23. for i = 1,100 do
  24. meleeRemote:FireServer(plr)
  25. end
  26. end
  27. end
  28. end)
  29.  
  30. wait(1)
  31. cooldown = false
  32. part:Destroy()
  33. end
  34.  
  35.  
  36. mouse.KeyDown:connect(function(key)
  37. if cooldown == false then
  38. if key:lower() == "f" then
  39.  
  40. punch()
  41.  
  42. end
  43. end
  44. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement