Advertisement
Guest User

Untitled

a guest
Mar 6th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.02 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local DarkZone = ReplicatedStorage.Skills.Impure.DarkZone.Remotes.DarkZone
  3. local TweenService = game:GetService("TweenService")
  4. local Debris = game:GetService("Debris")
  5. local Players = game:GetService("Players")
  6. local RunService = game:GetService("RunService")
  7. local StunEvent = game.ServerStorage.Events.Stun
  8. local Stun = require(game.ServerStorage.BadEffects.Stun)
  9. local Silence = require(game.ServerStorage.BadEffects.Silence)
  10. local Effects = require(game.ServerStorage.Effects)
  11. local Unstopable = require(game.ServerStorage.GoodEffects.Unstoppable)
  12. local PlayerD
  13. local PStuned = false
  14.  
  15.  
  16. local function createPosition(part,hp)
  17.     local Position = Vector3.new((part.CFrame.X - hp.CFrame.X) / 10,(part.CFrame.Y - hp.CFrame.Y) / 10,(part.CFrame.Z - hp.CFrame.Z) / 10)
  18.     return Position
  19. end
  20.  
  21. local function untrap(list)
  22.     Stun.RemoveStun(PlayerD.Character,0)
  23.     for i = 1, #list do
  24.         list[i]:WaitForChild("HumanoidRootPart").Anchored = false
  25.     end
  26. end
  27.  
  28. local function trapPlayers(c,part)
  29.     Silence.SilencePlayersAround(c,20,0)
  30.     local Stuned = Stun.StunPlayersAround(c,20,0)
  31.     for index = 1, #Stuned do
  32.         local hp = Stuned[index]:WaitForChild("HumanoidRootPart")
  33.         local Position = createPosition(part,hp)
  34.         coroutine.wrap(function()
  35.            for count = 1,10,1 do
  36.              hp.CFrame = hp.CFrame + Position
  37.              wait()
  38.            end
  39.         end)()
  40.     end
  41.     return Stuned
  42. end
  43.  
  44. StunEvent.Event:Connect(function(c)
  45.     if PlayerD then
  46.         if PlayerD.Character == c then
  47.             PStuned = true
  48.         end
  49.     end
  50. end)
  51.  
  52. local function darkZoneF(player)
  53.    
  54.     local Meshes = script.Meshes
  55.     local Character = player.Character
  56.     local Humanoid = Character:WaitForChild("Humanoid")
  57.     local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
  58.     local Track = Humanoid:LoadAnimation(script.DZone1)
  59.     local Track2 = Humanoid:LoadAnimation(script.DZone2)
  60.     local Track3 = Humanoid:LoadAnimation(script.DZone3)
  61.     local Position
  62.     local Model = Meshes:WaitForChild("Model"):Clone()
  63.    
  64.    
  65.     Model.Parent = workspace
  66.     Model.Name = player.Name.." DZone"
  67.     Model.PrimaryPart = Model.Hbox
  68.    
  69.     local mDark = Meshes:WaitForChild("MDarkZone"):Clone()
  70.     mDark.CFrame = Character:WaitForChild("LeftHand").CFrame * CFrame.new(0.8,0,-0.1)
  71.     mDark.Parent = workspace
  72.  
  73.     local weld = Instance.new("WeldConstraint")
  74.     weld.Parent = Model
  75.     weld.Part0 = mDark
  76.     weld.Part1 = Character:WaitForChild("LeftHand")
  77.  
  78.     Track2:Play()
  79.     Track:Play()
  80.  
  81.     for count = 1,5,1 do
  82.       if PStuned == true then
  83.           Model:Destroy()
  84.           mDark:Destroy()
  85.           break
  86.       end  
  87.       mDark.Transparency = mDark.Transparency - 0.2
  88.       wait(0.2)
  89.     end
  90.  
  91.     if PStuned == true then
  92.       Model:Destroy()
  93.       mDark:Destroy()
  94.       Track2:Stop()
  95.       return
  96.     end
  97.  
  98.     Unstopable.Set(Character)
  99.    
  100.     wait(1)
  101.  
  102.     HumanoidRP.Anchored = true
  103.  
  104.     Position = Vector3.new(HumanoidRP.CFrame.X, HumanoidRP.CFrame.Y,HumanoidRP.CFrame.Z)
  105.     Model:MoveTo(Position)
  106.  
  107.     mDark.Parent = Model
  108.  
  109.     Position = createPosition(Model.Hbox,HumanoidRP)
  110.  
  111.     local Stunned = trapPlayers(Character,Model.Hbox)
  112.    
  113.     for count = 1,10,1 do
  114.       HumanoidRP.CFrame = HumanoidRP.CFrame + Position
  115.       wait()
  116.     end
  117.  
  118.     weld:Destroy()
  119.  
  120.     mDark.Anchored = true
  121.  
  122.     mDark.CFrame = Model.Hbox.CFrame
  123.  
  124.     Track3:Play()
  125.  
  126.     Track2:Stop()
  127.  
  128.     for count = 1,10,1 do
  129.       mDark.Size = mDark.Size + Vector3.new(6.9,6.9,6.9)
  130.       wait()
  131.     end
  132.  
  133.     mDark.CanCollide = true
  134.  
  135.     HumanoidRP.Anchored = false
  136.  
  137.     untrap(Stunned)
  138.  
  139.     wait(10)
  140.  
  141.     Model.Hbox:Destroy()
  142.     Model.MDarkZone:Destroy()
  143.     Unstopable.Remove(Character)
  144.     Silence.RemoveSilence(Character,0)
  145.     Debris:AddItem(Model,10)
  146.      
  147. end
  148.  
  149.  
  150. local function checkEnable(player)
  151.     local checkSkill = require(game.ServerStorage.CheckCanSkill)
  152.    
  153.     if checkSkill.Check(player,"DZone") == true then
  154.         PStuned = false
  155.         PlayerD = player
  156.         print("wwatatat")
  157.         darkZoneF(player)
  158.     end
  159.        
  160. end
  161.  
  162. DarkZone.OnServerEvent:Connect(checkEnable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement