Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. --SynapseX Decompiler
  2.  
  3. local module = {}
  4. local network = require(script.Parent:WaitForChild("network"))
  5. local utilities = require(script.Parent:WaitForChild("utilities"))
  6. local placeSetup = require(script.Parent:WaitForChild("placeSetup"))
  7. local entityManifestCollectionFolder = placeSetup.awaitPlaceFolder("entityManifestCollection")
  8. local runService = game:GetService("RunService")
  9. local rand = Random.new(os.time())
  10. function module.getDamagableTargets(playerDoingDamage)
  11. local damagableTargets = {}
  12. for i, entityManifest in pairs(entityManifestCollectionFolder:GetChildren()) do
  13. if entityManifest:IsA("BasePart") and not entityManifest:FindFirstChild("pet") and entityManifest:FindFirstChild("entityType") and entityManifest.entityType.Value == "monster" then
  14. table.insert(damagableTargets, entityManifest)
  15. end
  16. end
  17. local nonSerializeData
  18. if runService:IsServer() then
  19. local playerData = network:invoke("getPlayerData", playerDoingDamage)
  20. if playerData then
  21. nonSerializeData = playerData.nonSerializeData
  22. end
  23. elseif runService:IsClient() then
  24. nonSerializeData = network:invoke("getCacheValueByNameTag", "nonSerializeData")
  25. end
  26. if not nonSerializeData then
  27. print("no serialize")
  28. return damagableTargets
  29. end
  30. if nonSerializeData.isGlobalPVPEnabled or #nonSerializeData.whitelistPVPEnabled > 0 then
  31. local playersToScan = nonSerializeData.isGlobalPVPEnabled and game.Players:GetPlayers() or nonSerializeData.whitelistPVPEnabled
  32. for i, playerToScan in pairs(playersToScan) do
  33. if playerToScan ~= playerDoingDamage and playerToScan:FindFirstChild("isInPVP") and playerToScan.isInPVP.Value and playerToScan.Character and playerToScan.Character.PrimaryPart then
  34. table.insert(damagableTargets, playerToScan.Character.PrimaryPart)
  35. end
  36. end
  37. end
  38. return damagableTargets
  39. end
  40. function module.canPlayerDamageTarget(playerDoingDamage, target)
  41. if not target then
  42. return false, nil
  43. end
  44. local damagableTargets = module.getDamagableTargets(playerDoingDamage)
  45. local trueTarget = target
  46. if runService:IsClient() and target:IsDescendantOf(workspace.placeFolders.entityRenderCollection) then
  47. local currentLocation = target
  48. local clientHitboxToServerHitboxReference
  49. while not currentLocation:FindFirstChild("clientHitboxToServerHitboxReference") and currentLocation ~= workspace.placeFolders.entityRenderCollection do
  50. currentLocation = currentLocation.Parent
  51. end
  52. if currentLocation:FindFirstChild("clientHitboxToServerHitboxReference") then
  53. trueTarget = currentLocation.clientHitboxToServerHitboxReference.Value
  54. end
  55. end
  56. for i, damagableTarget in pairs(damagableTargets) do
  57. if trueTarget == damagableTarget then
  58. return true, trueTarget
  59. end
  60. end
  61. return false, trueTarget
  62. end
  63. return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement