Advertisement
moathon

scriptPart3

Apr 29th, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.44 KB | None | 0 0
  1. script.Name = "Freeze"
  2. wait()
  3. print(script.Parent.Name)
  4. print(script.Name)
  5. local Target = script:WaitForChild("Target").Value
  6. Target = script.Parent
  7.  
  8. local Sounds = {
  9.     IceCrack = script:WaitForChild("IceCrack"),
  10.     Shatter = script:WaitForChild("Shatter")
  11. }
  12.  
  13. local Torso = Target:FindFirstChild("Torso") or Target:FindFirstChild("UpperTorso")
  14.  
  15. if not Target then script:Destroy() end
  16.  
  17. local Humanoid = Target:FindFirstChildOfClass("Humanoid")
  18. Humanoid:UnequipTools()
  19.  
  20. local Stop = false
  21. coroutine.wrap(function()
  22.     repeat
  23.         Humanoid.JumpPower = 0
  24.         Humanoid.WalkSpeed = 0
  25.         game:GetService("RunService").Heartbeat:Wait()
  26.     until Stop
  27. end)()
  28.  
  29. local Services = {
  30.     Players = (game:FindService("Players") or game:GetService("Players")),
  31.     Debris = (game:FindService("Debris") or game:GetService("Debris")),
  32.     RunService = (game:FindService("RunService") or game:GetService("RunService")),
  33. }
  34.  
  35. function Create(ty)
  36.     return function(data)
  37.         local obj = Instance.new(ty)
  38.         for k, v in pairs(data) do
  39.             if type(k) == 'number' then
  40.                 v.Parent = obj
  41.             else
  42.                 obj[k] = v
  43.             end
  44.         end
  45.         return obj
  46.     end
  47. end
  48.  
  49. if Services.Players:GetPlayerFromCharacter(Target) then
  50.     local Disable = script:WaitForChild("DisableBackpack")
  51.     Disable.Parent = Services.Players:GetPlayerFromCharacter(Target):WaitForChild("Backpack")
  52.     Disable.Disabled = false
  53.     Services.Debris:AddItem(Disable,1)
  54.     Services.Players:GetPlayerFromCharacter(Target).CharacterRemoving:Connect(function(Char)--keeps people from a hidden inventory
  55.         local Enable = script:WaitForChild("EnableBackpack")
  56.         Enable.Parent = Services.Players:GetPlayerFromCharacter(Target):WaitForChild("Backpack")
  57.         Enable.Disabled = false
  58.         Services.Debris:AddItem(Enable,1)
  59.     end)
  60. end
  61.  
  62. local ice = Create("Part"){
  63.     Shape = "Block",
  64.     Size = Vector3.new(4.2,4,6.3)*0,
  65.     CanCollide = false,
  66.     Anchored = true,
  67.     Locked = true,
  68.     Name = "Ice Block",
  69.     CFrame = Torso.CFrame*CFrame.Angles(math.rad(-90),0,0),
  70.     Transparency = 0.4,
  71.     Parent = Target,
  72. }
  73.  
  74. local iceBlockMesh = Create("SpecialMesh"){
  75.     MeshId = "http://www.roblox.com/asset/?id=66876751",
  76.     TextureId = "http://www.roblox.com/asset/?id=3096741240",
  77.     Scale = Vector3.new(1.0, 1.0, 1.0)*0,
  78.     Parent = ice,
  79. }
  80.  
  81. Sounds.IceCrack.Parent = ice
  82. Sounds.IceCrack:Play()
  83.  
  84. local Puff = script:WaitForChild("Puff")
  85. Puff.Parent = ice
  86. Puff.Enabled = true
  87.  
  88. local FrozenParts = {}
  89.  
  90. for _,parts in pairs(Target:GetChildren()) do
  91.     if parts:IsA("BasePart") and Humanoid:GetLimb(parts) then
  92.         if parts.Anchored == false then
  93.         parts.Anchored = true
  94.         FrozenParts[#FrozenParts+1] = parts
  95.         end
  96.     end
  97. end
  98.  
  99. for i=1,74,1 do
  100.     ice.Size = (Vector3.new(4.2,4,6.3)*.1):lerp(Vector3.new(4.2,4,6.3),i/74)
  101.     iceBlockMesh.Scale = (Vector3.new(1.0, 1.0, 1.0)*.1):lerp(Vector3.new(1.0, 1.0, 1.0),i/74)
  102.     ice.CFrame = Torso.CFrame*CFrame.Angles(math.rad(-90),0,0)
  103.     Services.RunService.Heartbeat:Wait()
  104. end
  105.  
  106. local Duration,Start = 6.7,tick()
  107.  
  108. repeat
  109.     Services.RunService.Heartbeat:Wait()
  110. until (tick()-Start) >= Duration or Humanoid.Health <= 0
  111.  
  112. Sounds.Shatter.Parent = Torso
  113. Sounds.Shatter:Play()
  114. wait(1.7)
  115. Services.Debris:AddItem(Sounds.Shatter,Sounds.Shatter.TimeLength+1)
  116.  
  117. Stop = true
  118. ice:Destroy()
  119. Humanoid.JumpPower = 50
  120. Humanoid.WalkSpeed = 16
  121.  
  122. local Seed = Random.new(tick())
  123.  
  124. for _, parts in pairs(FrozenParts) do
  125.     if parts then
  126.         parts.Anchored = false
  127.         local DebrisIce = Create("Part"){
  128.             Size = Vector3.new(Seed:NextNumber(1,2),Seed:NextNumber(1,2),Seed:NextNumber(1,2)),
  129.             Locked = true,
  130.             Anchored = false,
  131.             Name = "Broken Ice",
  132.             CFrame = parts.CFrame,
  133.             Transparency = 0.3,
  134.             CanCollide = false,
  135.             Material = Enum.Material.Glass,
  136.             TopSurface = Enum.SurfaceType.Smooth,
  137.             BottomSurface = Enum.SurfaceType.Smooth,
  138.             Color = (Seed:NextInteger(1,3) == 1 and Color3.fromRGB(170,255,255)) or Color3.fromRGB(0,170,255),
  139.             Parent = workspace
  140.         }
  141.         Services.Debris:AddItem(DebrisIce,Seed:NextNumber(3,5))
  142.     end
  143. end
  144.  
  145. local FrostSparkles = script:WaitForChild("FrostSparkles")
  146. FrostSparkles.Parent = Torso
  147. FrostSparkles:Emit(FrostSparkles.Rate)
  148. Services.Debris:AddItem(FrostSparkles,FrostSparkles.Lifetime.Max)
  149.  
  150. if Services.Players:GetPlayerFromCharacter(Target) then
  151.     local Enable = script:WaitForChild("EnableBackpack")
  152.     Enable.Parent = Services.Players:GetPlayerFromCharacter(Target):WaitForChild("Backpack")
  153.     Enable.Disabled = false
  154.     Services.Debris:AddItem(Enable,1)
  155. end
  156.  
  157. wait(2) -- Grace period (Your're Welcome EuroC2)
  158.  
  159. script:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement