Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Name = "TimeStop"
- print(script.Parent.Name)
- wait()
- local freezing = true
- local sound = script.Parent.Handle.TimeResume
- local player = script.Parent.Parent
- local kids = player:GetDescendants()
- local you = game.Players:GetPlayerFromCharacter(player)
- --local backpack = you.BackPack:GetChildren()
- local frozen = {}
- local frozen1 = 1
- local younfreezeme = {}
- local unfrze = 1
- for i=1,#kids do
- if kids[i]:IsA("Script") or kids[i]:IsA("LocalScript") then
- if kids[i].Disabled == false then
- younfreezeme[i]=kids[i]
- unfrze = unfrze + 1
- end
- end
- end
- wait()
- script.Parent = game.Workspace
- --for i=1,#kids do
- --print(kids[i].Name)
- --end
- function unfreezeplr(thing)
- for i=1,#thing do
- if thing[i]:IsA("BasePart") then
- thing[i].Anchored = false
- end
- end
- for ii=1,unfrze do
- if younfreezeme[ii] ~= nil then
- younfreezeme[ii].Disabled = false
- --print(younfreezeme[ii].Name.." was unfrozen")
- ii=ii+1
- end
- end
- end
- function freeze(thing)
- if thing:IsA("BasePart") then
- for i=1, #kids do
- if thing.Anchored == false and thing ~= kids[i] then
- thing.Anchored = true
- frozen[frozen1] = thing
- frozen1 = frozen1 + 1
- end
- end
- if thing:IsA("Script") or thing:IsA("LocalScript") then
- for i=1,#kids do
- if thing.Disabled == false and thing ~= kids[i] then
- thing.Disabled = true
- frozen[frozen1] = thing
- frozen1 = frozen1+1
- end
- end
- end
- end
- end
- function doublecheck(thing)
- if thing:IsA("Tool") then
- --print("A tool was equipped")
- local getkids = thing:GetDescendants()
- if thing.Parent == player then
- --print("This tools parent is firemomo45")
- for i, v in pairs(frozen) do
- if (frozen[i] == getkids[i]) then
- --print("One of this tools kids is anchored")
- if getkids[i]:IsA("BasePart") then
- getkids[i].Anchored = false
- --print(getkids[i].Name.." was unfrozen")
- end
- if getkids[i]:IsA("Script") or getkids[i]:IsA("LocalScript") then
- getkids[i].Disabled = false
- --print(getkids[i].Name.." was undisabled")
- end
- end
- end
- end
- end
- for i, v in pairs(kids) do
- if kids[i]:IsA("BasePart") then
- kids[i].Anchored = false
- --print(kids[i].Name.." was unfrozen")
- end
- if kids[i].Name == "Handle" then
- kids[i].Anchored = false
- --print(kids[i].Name.." was unfrozen")
- end
- if (kids[i] == frozen[i]) then
- if kids[i]:IsA("Script") or kids[i]:IsA("LocalScript") then
- kids[i].Disabled = false
- --print(kids[i].Name.." was undisabled")
- end
- end
- end
- end
- game.Workspace.DescendantAdded:Connect(function(thing)
- if freezing == true then
- freeze(thing)
- doublecheck(thing)
- unfreezeplr(kids)
- end
- end)
- player.DescendantAdded:Connect(function(thing)
- --print(thing.Name)
- wait()
- if thing:IsA("Part") then
- thing.Anchored = false
- end
- end)
- sound.Ended:Connect(function()
- wait(1)
- freezing = false
- for i=1,#frozen do
- if frozen[i]:IsA("Script") or frozen[i]:IsA("LocalScript") then
- frozen[i].Disabled = false
- end
- if frozen[i]:IsA("BasePart") then
- frozen[i].Anchored = false
- end
- end
- wait()
- script:Destroy()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement