Advertisement
lV0rd

Serverside

Mar 14th, 2024
4,532
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 2 0
  1. local module = {}
  2.  
  3. local repStorage = game:GetService("ReplicatedStorage").Remotes.Events
  4. local remote = repStorage:WaitForChild("M1")
  5. local remoteKB = repStorage:WaitForChild("KB")
  6.  
  7. function fireAllExcept(remote, plrExc, trgt, tip)
  8.     for i, v in game.Players:GetPlayers() do
  9.         if v == plrExc then continue end
  10.         remote:FireClient(trgt, tip)
  11.     end
  12. end
  13.  
  14. function module.Initialize()
  15.     remote.OnServerEvent:Connect(function(plr, target: Humanoid, tipe)
  16.         print("esdq")
  17.         if tipe == "b" then
  18.             target:TakeDamage(10)
  19.             local char : BasePart= target.Parent.HumanoidRootPart
  20.  
  21.         --[[
  22.         local linVel = script.LinearVelocity:Clone()
  23.         local att = Instance.new("Attachment", char)
  24.         linVel.Attachment0 = att
  25.         linVel.VectorVelocity = plr.Character.HumanoidRootPart.CFrame.LookVector * 40
  26.         game.Debris:AddItem(linVel, .3)
  27.         ]]
  28.             --local og = char:GetNetworkOwner()
  29.             --char:SetNetworkOwner(plr)
  30.  
  31.             if game.Players:GetPlayerFromCharacter(char) then
  32.                 remoteKB:FireClient(game.Players:GetPlayerFromCharacter(char), plr.Character.HumanoidRootPart.CFrame.LookVector * 20, tipe)
  33.                 fireAllExcept(remote, plr, target, "ba")
  34.             else
  35.                 local fecForce = script.BodyVelocity:Clone()
  36.                 fecForce.MaxForce = Vector3.new(math.huge,0,math.huge)
  37.                 fecForce.Parent = char
  38.                 fecForce.Velocity = plr.Character.HumanoidRootPart.CFrame.LookVector * 20
  39.  
  40.                 game.Debris:AddItem(fecForce, .3)
  41.                 fireAllExcept(remote, plr, target, "ba")
  42.             end
  43.  
  44.  
  45.             --task.wait(.3)
  46.             --char:SetNetworkOwner(og)
  47.  
  48.  
  49.         end
  50.  
  51.     end)
  52.  
  53. end
  54.  
  55. return module
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement