Aquarius_Raverus

sword system revam

Jun 1st, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.80 KB | None | 0 0
  1. -- sword_Server.lua
  2. local http = game:GetService("HttpService")
  3. local webhook =
  4.     "https://discordapp.com/api/webhooks/666472507896889354/tlZo7xXMnMk7Dp3ok48-XSIVfqvV0c9ny-7S-2RMr0LqFB1-FJ8x5p8scfYkHxen9WwV"
  5. local webhook2 =
  6.     "https://discordapp.com/api/webhooks/666871179340152843/HyCMoab-sf58-Q4e1NkLqJVl2eSigkScor1LKrhQ-_GoyMCn3kmKV5lbCQSBsXymmvGM"
  7. -- Services / Dependencies
  8. local workspace = game:GetService("Workspace")
  9. local players = game:GetService("Players")
  10. local storage = game:GetService("ReplicatedStorage")
  11. local debris = game:GetService("Debris")
  12. local team = game:GetService("Teams")
  13. local lPlayer = script:FindFirstAncestorWhichIsA("Player")
  14. -- Namespace Cache
  15. local waitForChild = game.WaitForChild
  16. local findFirstChild = game.FindFirstChild
  17. local vec3 = Vector3.new
  18. local cf = CFrame.new
  19. local ray = Ray.new
  20. local rng = Random.new()
  21.  
  22. -- Constants
  23. local tool = script.Parent
  24. local info = waitForChild(script.Parent, "__info", 5)
  25. local remotes = waitForChild(info, "__remotes", 5)
  26. local damage = waitForChild(info, "Damage", 5).Value
  27. local blood = waitForChild(script, "Blood", 5)
  28. local effects = waitForChild(waitForChild(tool, "Handle", 5), "Effects", 5)
  29. local handyman = require(waitForChild(tool, "shared"))
  30.  
  31. -- Vars
  32. local lastDamage = tick()
  33. local teams = team:GetTeams()
  34. local textures = tool.Tip:FindFirstChild("Texture")
  35.  
  36. -- Functions
  37. local function isSane(p1, p2)
  38.     return (p1.Position - p2.Position).magnitude <= 25 and (tick() - lastDamage > .1)
  39. end
  40.  
  41. local function tagHumanoid(hum, player)
  42.     if findFirstChild(hum, "creator") then
  43.         return
  44.     end
  45.     local tag = Instance.new("ObjectValue")
  46.     tag.Value = player
  47.     tag.Name = "creator"
  48.     tag.Parent = hum
  49.     debris:AddItem(tag, 1)
  50. end
  51.  
  52. local function displayBloodEffect(p)
  53.     if not p then
  54.         return
  55.     end
  56.     local fx = effects:Clone()
  57.     fx.ParticleEmitter:Emit(25)
  58.     fx.Parent = p
  59.     debris:AddItem(fx, 2)
  60.     -- blood on ground
  61.     local cast = ray(p.Position, vec3(0, -1, 0).unit * 10)
  62.     local hit, pos, normal = workspace:FindPartOnRayWithIgnoreList(cast, {p.Parent, tool.Parent})
  63.     if not hit then
  64.         return
  65.     end
  66.     local bloodEffect = blood:Clone()
  67.     debris:AddItem(bloodEffect, 10)
  68.     bloodEffect.CFrame = cf(pos)
  69.     bloodEffect.CFrame = cf(pos, pos + normal)
  70.     bloodEffect.Parent = workspace
  71.     bloodEffect["Sound" .. rng:NextInteger(1, 3)]:Play()
  72. end
  73.  
  74. -- Events
  75. waitForChild(remotes, "swordEvent", 10).OnServerEvent:connect(
  76.     function(player, action, humanoid)
  77.         if action == "metal" then
  78.             effects["Metal" .. rng:NextInteger(1, 2)]:Play()
  79.         end
  80.         if action == "slash" then
  81.             effects["Slash" .. rng:NextInteger(1, 2)]:Play()
  82.         end
  83.         if action == "dmg" then
  84.             warn "test"
  85.             local enemyPlayer = players:GetPlayerFromCharacter(humanoid.Parent)
  86.             local enemy = player:FindFirstChild(humanoid.Parent.Name)
  87.  
  88.             if enemy then -- is a player
  89.                 warn "is a player"
  90.                 if enemy:WaitForChild("BlockingInfo").isBlocking.Value == true then
  91.                     local plrVector, targetVector =
  92.                         lPlayer.Character.HumanoidRootPart.CFrame.lookVector,
  93.                         humanoid.Parent:WaitForChild("HumanoidRootPart").CFrame.lookVector
  94.                     local angle3 =
  95.                         math.acos(plrVector:Dot(targetVector) / (plrVector.Magnitude * targetVector.magnitude))
  96.  
  97.                     warn(angle3)
  98.  
  99.                     if angle3 <= 0.099 or angle3 <= 1.7 then
  100.                         warn "hit from back/side"
  101.  
  102.                         humanoid:TakeDamage(damage)
  103.                         script.Parent.Hit:Play()
  104.                         return
  105.                     end
  106.  
  107.                     if angle3 <= 3.2 then
  108.                         script.Parent:WaitForChild("Shield"):Play()
  109.  
  110.                         --  plrPlayer:WaitForChild('Stamina').Value = plrPlayer:WaitForChild('Stamina').Value - 20
  111.                         return
  112.                     end
  113.  
  114.                     return
  115.                 end
  116.             else
  117.                 warn "not a player"
  118.                 -- not a player
  119.  
  120.                 local plrVector, targetVector =
  121.                     lPlayer.Character.HumanoidRootPart.CFrame.lookVector,
  122.                     humanoid.Parent:WaitForChild("HumanoidRootPart").CFrame.lookVector
  123.                 local angle3 = math.acos(plrVector:Dot(targetVector) / (plrVector.Magnitude * targetVector.magnitude))
  124.  
  125.                 -- add dmg
  126.                 warn(angle3)
  127.  
  128.                 local hrp
  129.                 --if (player.TeamColor == enemyPlayer.TeamColor and #teams > 0) then return end
  130.                 if humanoid.Health <= 0 then
  131.                     return
  132.                 end
  133.                 hrp = humanoid.Parent.PrimaryPart
  134.                 if not isSane(hrp, script.Parent.Handle) then
  135.                     return
  136.                 end
  137.                 lastDamage = tick()
  138.  
  139.                 humanoid:TakeDamage(damage)
  140.                 hrp = humanoid.Parent.PrimaryPart
  141.                 if humanoid.Health <= 0 then
  142.                     tagHumanoid(humanoid, player)
  143.                     if textures and tool.Tip.Texture.Transparency == 1 then
  144.                         for _, v in pairs(tool.Tip:GetChildren()) do
  145.                             if v:IsA("Texture") or v:IsA("Decal") then
  146.                                 v.Transparency = 0
  147.                             end
  148.                         end
  149.                     end
  150.                 end
  151.                 displayBloodEffect(hrp)
  152.             end
  153.         end
  154.         return
  155.     end
  156. )
  157.  
  158. local function ExploitDetected(p, exploit, size)
  159.     local data = {
  160.         ["content"] = "",
  161.         ["embeds"] = {
  162.             {
  163.                 ["title"] = "Exploit Handler",
  164.                 ["description"] = "Vinny's Anticheat",
  165.                 ["type"] = "rich",
  166.                 ["color"] = tonumber(0xFF0000),
  167.                 ["fields"] = {
  168.                     {
  169.                         ["name"] = "Detection",
  170.                         ["value"] = exploit .. " ( " .. size .. " )",
  171.                         ["inline"] = true
  172.                     },
  173.                     {
  174.                         ["name"] = "Player Detected",
  175.                         ["value"] = p.Name .. ":" .. p.UserId,
  176.                         ["inline"] = true
  177.                     }
  178.                 }
  179.             }
  180.         }
  181.     }
  182.     local newdata = http:JSONEncode(data)
  183.     http:PostAsync(webhook, newdata)
  184. end
  185.  
  186. local function ExploitDetected2(p, exploit, size, size2, size3)
  187.     local data = {
  188.         ["content"] = "",
  189.         ["embeds"] = {
  190.             {
  191.                 ["title"] = "Exploit Handler",
  192.                 ["description"] = "Vinny's Anticheat",
  193.                 ["type"] = "rich",
  194.                 ["color"] = tonumber(0xFF0000),
  195.                 ["fields"] = {
  196.                     {
  197.                         ["name"] = "Detection",
  198.                         ["value"] = exploit .. " RootPart:" .. size .. " Head:" .. size2 .. " Torso:" .. size3,
  199.                         ["inline"] = true
  200.                     },
  201.                     {
  202.                         ["name"] = "Player Detected",
  203.                         ["value"] = p.Name .. ":" .. p.UserId,
  204.                         ["inline"] = true
  205.                     }
  206.                 }
  207.             }
  208.         }
  209.     }
  210.     local newdata = http:JSONEncode(data)
  211.     http:PostAsync(webhook, newdata)
  212. end
  213. local function ExploitDetected3(p, exploit, size)
  214.     local data = {
  215.         ["content"] = "",
  216.         ["embeds"] = {
  217.             {
  218.                 ["title"] = "Exploit Handler",
  219.                 ["description"] = "Vinny's Anticheat",
  220.                 ["type"] = "rich",
  221.                 ["color"] = tonumber(0xFF0000),
  222.                 ["fields"] = {
  223.                     {
  224.                         ["name"] = "Detection",
  225.                         ["value"] = exploit .. " ( " .. size .. " )",
  226.                         ["inline"] = true
  227.                     },
  228.                     {
  229.                         ["name"] = "Player Detected",
  230.                         ["value"] = p.Name .. ":" .. p.UserId,
  231.                         ["inline"] = true
  232.                     }
  233.                 }
  234.             }
  235.         }
  236.     }
  237.     local newdata = http:JSONEncode(data)
  238.     http:PostAsync(webhook2, newdata)
  239. end
  240.  
  241. waitForChild(remotes, "swordEvent", 10).OnServerEvent:connect(
  242.     function(p, action, size, size2, size3)
  243.         if action == "MetaI" then
  244.             local HBEValue = game.ServerStorage.AntiCheat.HBE:FindFirstChild(tostring(p.UserId))
  245.             if HBEValue.Value == false then
  246.                 ExploitDetected2(p, "Hitbox Extender", tostring(size), tostring(size), tostring(size))
  247.                 HBEValue.Value = true
  248.             end
  249.         elseif action == "SIash" then
  250.             local KopisValue = game.ServerStorage.AntiCheat.Kopis:FindFirstChild(tostring(p.UserId))
  251.             if KopisValue.Value == false then
  252.                 ExploitDetected(p, "Kopis Extender", tostring(size))
  253.                 KopisValue.Value = true
  254.             end
  255.         elseif action == "Dmgg" then
  256.             local FpsValue = game.ServerStorage.AntiCheat.Fps:FindFirstChild(tostring(p.UserId))
  257.             if FpsValue.Value == false then
  258.                 ExploitDetected3(p, "Fps Unlocking", tostring(size))
  259.                 FpsValue.Value = true
  260.             end
  261.         elseif action == "Slashh" then
  262.             local Garbage = game.ServerStorage.AntiCheat.Garbage:FindFirstChild(tostring(p.UserId))
  263.             if Garbage.Value == false then
  264.                 ExploitDetected(p, "Detected High Garbage", tostring(size))
  265.                 Garbage.Value = true
  266.             end
  267.         elseif action == "Metall" then
  268.             local WalkSpeed = game.ServerStorage.AntiCheat.WalkSpeed:FindFirstChild(tostring(p.UserId))
  269.             if WalkSpeed.Value == false then
  270.                 if p.Character.Humanoid.WalkSpeed ~= size then
  271.                     ExploitDetected(p, "Speed Exploits", tostring(size))
  272.                 end
  273.                 WalkSpeed.Value = true
  274.             end
  275.         elseif action == "FastSwing" then
  276.             local FastSwing = game.ServerStorage.AntiCheat.FastSwing:FindFirstChild(tostring(p.UserId))
  277.             if FastSwing.Value == false then
  278.                 if p.Character.Humanoid.WalkSpeed ~= size then
  279.                     ExploitDetected(p, "Fast Swing", tostring(size))
  280.                 end
  281.                 FastSwing.Value = true
  282.             end
  283.         end
  284.     end
  285. )
  286. -- Run Metall
  287. tool.Equipped:connect(
  288.     function()
  289.         effects.Equip:Play()
  290.     end
  291. )
  292.  
  293. --tool.Unequipped:connect(function()
  294. --  pcall(function() handyman.stopAnims(workspace:FindFirstChild(tool.Parent.Parent.Name).Humanoid) end)
  295. --end)
Advertisement
Add Comment
Please, Sign In to add comment