Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ts = game:GetService("TweenService")
- local info = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
- script.Parent.OnServerEvent:Connect(function(plr)
- local chr = plr.Character
- local genjutsu = game.ReplicatedStorage.TimeStopGenjutsu:Clone()
- genjutsu.Parent = chr.HumanoidRootPart
- genjutsu.Position = chr.HumanoidRootPart.Position
- local prop = {
- Size = Vector3.new(179.39, 179.39, 179.39)
- }
- local tween = ts:Create(genjutsu, info, prop)
- tween:Play()
- local e = script.Parent.Parent.GenjutsuSound:Clone()
- e.Parent = workspace
- e:Play()
- wait(2)
- local pos1, pos2 = (genjutsu.Position - (genjutsu.Size / 2)), (genjutsu.Position + (genjutsu.Size / 2))
- local R3 = Region3.new(pos1, pos2)
- local RecordedParts = {}
- for _, Part in pairs(game.Workspace:FindPartsInRegion3(R3, nil, math.huge)) do
- if Part:IsA("Model") and Part:FindFirsrChild("Humanoid") then
- print(Part.Name.." is currently in the region")
- RecordedParts[Part.Name] = true
- end
- end
- while wait(1) do
- local ReturnedParts = game.Workspace:FindPartsInRegion3(R3, nil, math.huge)
- local ReformattedReturned = {}
- for key,Part in pairs(RecordedParts) do
- ReformattedReturned[key] = false
- end
- for _, Part in pairs(ReturnedParts) do
- print(Part.Name.." is currently in the region when looping")
- ReformattedReturned[Part.Name] = true
- end
- for Character, value in pairs(RecordedParts) do
- if Character == chr.Name then
- if not ReformattedReturned[Character] then
- print(Character.." has left the Region3!")
- RecordedParts[Character] = false -- Removes parts that have exited
- end
- end
- end
- for _, Part in pairs(ReturnedParts) do
- RecordedParts[Part.Name] = true
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement