SHARE
TWEET

Untitled

a guest Jun 16th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         local ReturnedParts = game.Workspace:FindPartsInRegion3(R3, nil, math.huge)
  29.         local ReformattedReturned = {}
  30.        
  31.         for key,Part in pairs(RecordedParts) do
  32.             ReformattedReturned[key] = false
  33.         end
  34.        
  35.         for _, Part in pairs(ReturnedParts) do
  36.             print(Part.Name.." is currently in the region when looping")
  37.             ReformattedReturned[Part.Name] = true
  38.         end
  39.  
  40.        for Character, value in pairs(RecordedParts) do
  41.             if Character == chr.Name then
  42.                 if not ReformattedReturned[Character] then
  43.                     print(Character.." has left the Region3!")
  44.                     RecordedParts[Character] = false -- Removes parts that have exited
  45.                 end
  46.             end
  47.         end
  48.  
  49.         for _, Part in pairs(ReturnedParts) do
  50.             RecordedParts[Part.Name] = true
  51.         end
  52.     end
  53. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top