carlosname

TS(no)

Jan 12th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- [[ Time Stop ]] ---
  2. -- by fo43123
  3.  
  4. if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
  5. do
  6.     script.Parent = owner.Character
  7.     local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  8.     local function NewFakeEvent()
  9.         local Bind = Instance.new("BindableEvent")
  10.         local Fake;Fake = {Connections = {},
  11.         fakeEvent=true;
  12.         Connect=function(self,Func)
  13.             Bind.Event:connect(Func)
  14.             self.Connections[Bind] = true
  15.             return setmetatable({Connected = true},{
  16.             __index = function (self,Index)
  17.                 if Index:lower() == "disconnect" then
  18.                     return function() Fake.Connections[Bind] = false;self.Connected = false end
  19.                 end
  20.                 return Fake[Index]
  21.             end;
  22.             __tostring = function() return "Connection" end;
  23.         })
  24.         end}
  25.         Fake.connect = Fake.Connect;return Fake;
  26.     end
  27.     local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  28.     local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  29.     local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  30.         self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  31.     end};ContextActionService.UnBindAction = ContextActionService.BindAction
  32.     local function TriggerEvent(self,Event,...)
  33.         local Trigger = Mouse[Event]
  34.         if Trigger and Trigger.fakeEvent and Trigger.Connections then
  35.             for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  36.         end
  37.     end
  38.     Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  39.     Event.OnServerEvent:Connect(function(FiredBy,Input)
  40.         if FiredBy.Name ~= owner.Name then return end
  41.         if Input.MouseEvent then
  42.             Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  43.         else
  44.             local Begin = Input.UserInputState == Enum.UserInputState.Begin
  45.             if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  46.             for _,Action in pairs(ContextActionService.Actions) do
  47.                 for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  48.             end
  49.             Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  50.             UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  51.         end
  52.     end)
  53.     InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  54.     Event.Parent = NLS([[
  55.         local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  56.         local Input = function(Input,gameProcessedEvent)
  57.             if gameProcessedEvent then return end
  58.             Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  59.         end
  60.         UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  61.         local Hit,Target
  62.         while wait(1/30) do
  63.             if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  64.                 Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  65.             end
  66.         end
  67.     ]],owner.Character)
  68. end
  69. RealGame = game;game = setmetatable({},{
  70.     __index = function (self,Index)
  71.         local Sandbox = function (Thing)
  72.             if Thing:IsA("Player") then
  73.                 local RealPlayer = Thing
  74.                 return setmetatable({},{
  75.                     __index = function (self,Index)
  76.                         local Type = type(RealPlayer[Index])
  77.                         if Type == "function" then
  78.                             if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  79.                                 return function (self)return InternalData["Mouse"] end
  80.                             end
  81.                             return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  82.                         end
  83.                         return RealPlayer[Index]
  84.                     end;
  85.                     __tostring = function(self) return RealPlayer.Name end
  86.                 })
  87.             end
  88.         end
  89.         if RealGame[Index] then
  90.             local Type = type(RealGame[Index])
  91.             if Type == "function" then
  92.                 if Index:lower() == "getservice" or Index:lower() == "service" then
  93.                     return function (self,Service)
  94.                         local FakeServices = {
  95.                             ["players"] = function()
  96.                                 return setmetatable({},{
  97.                                     __index = function (self2,Index2)
  98.                                         local RealService = RealGame:GetService(Service)
  99.                                         local Type2 = type(Index2)
  100.                                         if Type2 == "function" then
  101.                                             return function (self,...) return RealService[Index2](RealService,...)end
  102.                                         else
  103.                                             if Index2:lower() == "localplayer" then return Sandbox(owner) end
  104.                                             return RealService[Index2]
  105.                                         end
  106.                                     end;
  107.                                     __tostring = function(self) return RealGame:GetService(Service).Name end
  108.                                 })
  109.                             end;
  110.                             ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  111.                             ["userinputservice"] = function() return InternalData["UserInputService"] end;
  112.                             ["runservice"] = function()
  113.                                 return setmetatable({},{
  114.                                     __index = function(self2,Index2)
  115.                                         local RealService = RealGame:GetService(Service)
  116.                                         local Type2 = type(Index2)
  117.                                         if Type2 == "function" then
  118.                                             return function (self,...) return RealService[Index2](RealService,...) end
  119.                                         else
  120.                                             local RunServices = {
  121.                                                 ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  122.                                                 ["renderstepped"] = function() return RealService["Stepped"] end
  123.                                             }
  124.                                             if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  125.                                             return RealService[Index2]
  126.                                         end
  127.                                     end
  128.                                 })
  129.                             end
  130.                         }
  131.                         if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  132.                         return RealGame:GetService(Service)
  133.                     end
  134.                 end
  135.                 return function (self,...) return RealGame[Index](RealGame,...) end
  136.             else
  137.                 if game:GetService(Index) then return game:GetService(Index) end
  138.                 return RealGame[Index]
  139.             end
  140.         end
  141.         return nil
  142.     end
  143. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
  144.  
  145. local me = game.Players.LocalPlayer
  146. local mouse = me:GetMouse()
  147. local char = me.Character
  148. local hum = char:FindFirstChild('Humanoid')
  149. local hd = char:FindFirstChild('Head')
  150. local ts = char:FindFirstChild('Torso') or char:FindFirstChild('UpperTorso')
  151. local ra = char:FindFirstChild('Right Arm') or char:FindFirstChild('RightUpperArm')
  152. local la = char:FindFirstChild('Left Arm') or char:FindFirstChild('LeftUpperArm')
  153. local rl = char:FindFirstChild('Right Leg') or char:FindFirstChild('RightUpperLeg')
  154. local ll = char:FindFirstChild('Left Leg') or char:FindFirstChild('LeftUpperLeg')
  155. local root = char:FindFirstChild('HumanoidRootPart')
  156. local rj = root:FindFirstChild('RootJoint')
  157. local rs = ts:FindFirstChild('Right Shoulder')
  158. local ls = ts:FindFirstChild('Left Shoulder')
  159. local rh = ts:FindFirstChild('Right Hip')
  160. local lh = ts:FindFirstChild('Left Hip')
  161. local nk = ts:FindFirstChild('Neck')
  162. local anim = char:FindFirstChild('Animate')
  163. local base = workspace:FindFirstChild('Baseplate') or workspace:FindFirstChild('Base')
  164. local cantimestop = true
  165. local cooldown = false
  166. local cc = workspace.CurrentCamera
  167. local cos = math.cos
  168. local sin = math.sin
  169. local rad = math.rad
  170. local rand = math.random
  171. local cfn = CFrame.new
  172. local cfa = CFrame.Angles
  173. local v3 = Vector3.new
  174. local str = string
  175. local unfreeze = {}
  176. local health = {}
  177. local connect = {}
  178. local sine = 0
  179. local effects = nil
  180. hum.WalkSpeed = 23
  181. if char:FindFirstChild('Effects') then
  182.     effects = char:FindFirstChild('Effects')
  183. else
  184.     effects = Instance.new('Folder', char)
  185.     effects.Name = 'Effects'
  186. end
  187.  
  188. ArtificialHB = Instance.new('BindableEvent', script)
  189. ArtificialHB.Name = 'Heartbeat'
  190. script:WaitForChild('Heartbeat')
  191.  
  192. frame = 1 / 60
  193. tf = 0
  194. allowframeloss = false
  195. tossremainder = false
  196. lastframe = tick()
  197. script.Heartbeat:Fire()
  198.  
  199. game:GetService('RunService').Heartbeat:connect(function(s, p)
  200.     tf = tf + s
  201.     if tf >= frame then
  202.         if allowframeloss then
  203.             script.Heartbeat:Fire()
  204.             lastframe = tick()
  205.         else
  206.             for i = 1, math.floor(tf / frame) do
  207.                 script.Heartbeat:Fire()
  208.             end
  209.             lastframe = tick()
  210.         end
  211.         if tossremainder then
  212.             tf = 0
  213.         else
  214.             tf = tf - frame * math.floor(tf / frame)
  215.         end
  216.     end
  217. end)
  218.  
  219. function swait(t)
  220.     if t == 0 or t == nil then
  221.         script.Heartbeat.Event:Wait()
  222.     else
  223.         for i = 0, t do
  224.             script.Heartbeat.Event:Wait()
  225.         end
  226.     end
  227. end
  228.  
  229. function sound(id, parent, vol, pitch, timepos)
  230.     local s = Instance.new('Sound')
  231.     s.Parent = parent
  232.     s.SoundId = id
  233.     s.Volume = vol
  234.     s.PlaybackSpeed = pitch
  235.     s.TimePosition = timepos
  236.     s:Play()
  237.     game.Debris:AddItem(s, s.PlaybackSpeed + 5)
  238. end
  239.  
  240. function camshake(duration, intensity)
  241.     coroutine.wrap(function()
  242.         for i = 1, duration do
  243.             hum.CameraOffset = hum.CameraOffset:lerp(v3(rand(-1, 1), rand(-1, 1), rand(-1, 1)), 0.1 * intensity)
  244.             swait()
  245.         end
  246.         hum.CameraOffset = v3(0, 0, 0)
  247.     end)()
  248. end
  249.  
  250. function findascendant(obj, class)
  251.     local par = obj
  252.     local ret = nil
  253.     pcall(function()
  254.         repeat
  255.             par = par.Parent
  256.             if par:IsA(class) then
  257.                 ret = par
  258.                 break
  259.             end
  260.         until par == nil
  261.     end)
  262.     return ret
  263. end
  264.  
  265. local TimeStopSounds = {
  266.    
  267.     TimeStop = 'rbxassetid://2152227673';
  268.     TimeResume = 'rbxassetid://864569342';
  269.    
  270. }
  271.  
  272. function timestop()
  273.     cantimestop = false
  274.     coroutine.wrap(function()
  275.     local effect1 = Instance.new('Part', effects)
  276.     effect1.Shape = 'Ball'
  277.     effect1.Material = 'ForceField'
  278.     effect1.Anchored = true
  279.     effect1.CanCollide = false
  280.     effect1.Size = v3(0, 0, 0)
  281.     effect1.Transparency = 0
  282.     sound(TimeStopSounds.TimeStop, ts, 5, 1, 0)
  283.     for i,v in pairs(workspace:GetDescendants()) do
  284.         if v:IsA('BasePart') then
  285.             if not v.Anchored and not findascendant(v, 'Tool') and not findascendant(v, 'HopperBin') then
  286.                 if not v:IsDescendantOf(char) then
  287.                     v.Anchored = true
  288.                     table.insert(unfreeze, v)
  289.                 end
  290.             end
  291.         end
  292.         if v:IsA('Sound') then
  293.             if not v:IsDescendantOf(char) then
  294.                 if v.IsPlaying then
  295.                     v:Pause()
  296.                     table.insert(unfreeze, v)
  297.                 end
  298.             end
  299.         end
  300.         if v:IsA('Humanoid') then
  301.             local last = v.Health
  302.             local always = last
  303.             local e = v.HealthChanged:connect(function(hp)
  304.                 if last - hp > 0 then
  305.                     table.insert(health, {humanoid = v, change = last - hp})
  306.                 end
  307.                 last = hp
  308.                 v.Health = always
  309.             end)
  310.             table.insert(connect, e)
  311.         end
  312.         if v:IsA('BodyVelocity') then
  313.             local lastforce = v.MaxForce
  314.             v.MaxForce = v3(0, 0, 0)
  315.             table.insert(unfreeze, {force = v, change = lastforce})
  316.         end
  317.         if v:IsA('BodyPosition') then
  318.             local lastposition = v.MaxForce
  319.             local lastD = v.D
  320.             local lastP = v.P
  321.             v.MaxForce = v3(0, 0, 0)
  322.             v.D = 0
  323.             v.P = 0
  324.             table.insert(unfreeze, {position = v, change = lastposition, dchange = lastD, pchange = lastP})
  325.         end
  326.         if v:IsA('BodyForce') then
  327.             local lastforce2 = v.Force
  328.             v.Force = v3(0, 0, 0)
  329.             table.insert(unfreeze, {force2 = v, fchange = lastforce2})
  330.         end
  331.     end
  332.     ee = workspace.DescendantAdded:Connect(function(v)
  333.         if v:IsA('BasePart') then
  334.             if not v.Anchored and not findascendant(v, 'Tool') and not findascendant(v, 'HopperBin') then
  335.                 if not v:IsDescendantOf(char) then
  336.                     v.Anchored = true
  337.                     table.insert(unfreeze, v)
  338.                 end
  339.             end
  340.         end
  341.         if v:IsA('Sound') then
  342.             if not v:IsDescendantOf(char) then
  343.                 if v.IsPlaying then
  344.                     v:Pause()
  345.                     table.insert(unfreeze, v)
  346.                 end
  347.             end
  348.         end
  349.         if v:IsA('Humanoid') then
  350.             local last = v.Health
  351.             local always = last
  352.             local e = v.HealthChanged:connect(function(hp)
  353.                 if last - hp > 0 then
  354.                     table.insert(health, {humanoid = v, change = last - hp})
  355.                 end
  356.                 last = hp
  357.                 v.Health = always
  358.             end)
  359.             table.insert(connect, e)
  360.         end
  361.     end)
  362.     coroutine.wrap(function()
  363.         for i = 1, 10 do
  364.             camshake(70, 2)
  365.             swait(5)
  366.         end
  367.     end)()
  368.     coroutine.wrap(function()
  369.     for i = 1, 1000 do
  370.         effect1.CFrame = ts.CFrame
  371.         effect1.Size = effect1.Size:lerp(v3(50, 50, 50), 0.015)
  372.         effect1.Transparency = effect1.Transparency + 0.010
  373.         if effect1.Transparency >= 1 then
  374.             effect1:Destroy()
  375.         end
  376.         swait()
  377.     end
  378.     end)()
  379.     wait(0.5)
  380.     local effect2 = Instance.new('Part', effects)
  381.     local effect3 = Instance.new('Part', effects)
  382.     effect3.Shape = 'Ball'
  383.     effect3.Material = 'ForceField'
  384.     effect3.Anchored = true
  385.     effect3.CanCollide = false
  386.     effect3.Size = v3(0, 0, 0)
  387.     effect3.Transparency = 0
  388.     effect2.Shape = 'Ball'
  389.     effect2.Material = 'ForceField'
  390.     effect2.Anchored = true
  391.     effect2.CanCollide = false
  392.     effect2.Size = v3(40, 40, 40)
  393.     effect2.Transparency = 1
  394.     coroutine.wrap(function()
  395.         for i = 1, 15 do
  396.             effect2.Transparency = effect2.Transparency - 0.11
  397.             swait()
  398.         end
  399.     end)()
  400.     coroutine.wrap(function()
  401.         for i = 1, 1000 do
  402.             effect3.CFrame = ts.CFrame
  403.             effect3.Size = effect3.Size:lerp(v3(50, 50, 50), 0.015)
  404.             effect3.Transparency = effect3.Transparency + 0.010
  405.             if effect3.Transparency >= 1 then
  406.                 effect3:Destroy()
  407.             end
  408.             swait()
  409.         end
  410.     end)()
  411.     for i = 1, 1000 do
  412.         effect2.CFrame = ts.CFrame
  413.         effect2.Size = effect2.Size:lerp(v3(0, 0, 0), 0.015)
  414.         effect2.Transparency = effect2.Transparency + 0.015
  415.         if effect2.Transparency >= 1 then
  416.             effect2:Destroy()
  417.         end
  418.         swait()
  419.     end
  420.     end)()
  421.     wait(1.5) -- cooldown
  422.     cooldown = true
  423. end
  424.  
  425. function timeresume()
  426.     coroutine.wrap(function()
  427.     sound(TimeStopSounds.TimeResume, ts, 5, 1, 0.15)
  428.     coroutine.wrap(function()
  429.         for i = 1, 10 do
  430.             camshake(20, 0.3)
  431.             swait(5)
  432.         end
  433.     end)()
  434.     coroutine.wrap(function()
  435.         wait(1.5)
  436.     for i,v in pairs(unfreeze) do
  437.         pcall(function()
  438.             v.Anchored = false
  439.         end)
  440.         pcall(function()
  441.             v:Resume()
  442.         end)
  443.     end
  444.     for i,v in pairs(connect) do
  445.         pcall(function()
  446.             v:Disconnect()
  447.         end)
  448.     end
  449.     for i,v in pairs(health) do
  450.         pcall(function()
  451.             local humanoid = v.humanoid
  452.             humanoid.Health = humanoid.Health - v.change
  453.             if humanoid.Parent:FindFirstChild('Health') then
  454.                 pcall(function()
  455.                     humanoid.Parent.Health.Disabled = false
  456.                 end)
  457.             end
  458.         end)
  459.     end
  460.     pcall(function()
  461.         ee:Disconnect()
  462.     end)
  463.     health = {}
  464.     unfreeze = {}
  465.     end)()
  466.     cantimestop = true
  467.     end)()
  468.     wait(1.5) -- cooldown
  469.     cooldown = false
  470. end
  471.  
  472. mouse.KeyDown:connect(function(key)
  473.     if str.lower(key) == 'r' and cantimestop and cooldown == false then
  474.         timestop()
  475.     elseif str.lower(key) == 'r' and cantimestop == false and cooldown then
  476.         timeresume()
  477.     end
  478. end)
Add Comment
Please, Sign In to add comment