Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. local ts = game:GetService("TweenService")
  2. local info = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
  3. script.Parent.OnServerEvent:Connect(function(plr)
  4. local chr = plr.Character
  5. local genjutsu = game.ReplicatedStorage.TimeStopGenjutsu:Clone()
  6. genjutsu.Parent = chr.HumanoidRootPart
  7. genjutsu.Position = chr.HumanoidRootPart.Position
  8. local prop = {
  9. Size = Vector3.new(179.39, 179.39, 179.39)
  10. }
  11. local tween = ts:Create(genjutsu, info, prop)
  12. tween:Play()
  13. local e = script.Parent.Parent.GenjutsuSound:Clone()
  14. e.Parent = workspace
  15. e:Play()
  16. wait(2)
  17. local pos1, pos2 = (genjutsu.Position - (genjutsu.Size / 2)), (genjutsu.Position + (genjutsu.Size / 2))
  18. local R3 = Region3.new(pos1, pos2)
  19.  
  20. local RecordedParts = {}
  21. for _, Part in pairs(game.Workspace:FindPartsInRegion3(R3, nil, math.huge)) do
  22. if Part:IsA("Model") and Part:FindFirsrChild("Humanoid") then
  23. print(Part.Name.." is currently in the region")
  24. RecordedParts[Part.Name] = true
  25. end
  26. end
  27. while wait(1) do
  28. print("-----------------------------------")
  29. local ReturnedParts = game.Workspace:FindPartsInRegion3(R3, nil, math.huge)
  30. local ReformattedReturned = {}
  31.  
  32. for key,Part in pairs(RecordedParts) do
  33. print(key.." is what in the RecordedParts array ")
  34. ReformattedReturned[key] = false
  35. end
  36. print("-----------------------------------")
  37.  
  38. for _, Part in pairs(ReturnedParts) do
  39. if Part:IsA("Model") and Part:FindFirsrChild("Humanoid") then
  40. print(Part.Name.." is currently in the region when looping")
  41. ReformattedReturned[Part.Name] = true
  42. end
  43. end
  44. print("-----------------------------------")
  45. for Character, value in pairs(RecordedParts) do
  46. if Character == chr.Name then
  47. if not ReformattedReturned[Character] then
  48. print(Character.." has left the Region3!")
  49. RecordedParts[Character] = false -- Removes parts that have exited
  50. end
  51. end
  52. end
  53.  
  54. for _, Part in pairs(ReturnedParts) do
  55. RecordedParts[Part.Name] = true
  56. end
  57. print("-----------------------------------")
  58. end
  59. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement