Advertisement
SxScripting

Snap Gate Script [ New! ]

Mar 29th, 2021
1,750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. local Tool = script.Parent
  2. local Player = Tool.Parent.Parent
  3. local Character = Player.Character or Player.CharacterAdded:Wait()
  4. local Debounce,IsOn = {}, false
  5. local Debounce2 = {}
  6.  
  7. if Debounce[Player] then return end
  8.  
  9. Tool.Activated:Connect(function()
  10. if IsOn then return end --true
  11. local GateEffect = game.ReplicatedStorage.WarpEffect:Clone()
  12. GateEffect.Parent = game.Workspace
  13. Debounce[Player] = GateEffect
  14. IsOn = true
  15.  
  16. local WC = Instance.new("WeldConstraint",GateEffect)
  17. GateEffect.CFrame = Character.HumanoidRootPart.CFrame
  18. WC.Part0 = GateEffect
  19. WC.Part1 = Character.HumanoidRootPart
  20.  
  21. wait(5)
  22. if IsOn then IsOn = false Debounce[Player]:Destroy() end
  23. end)
  24.  
  25. Tool.Unequipped:Connect(function()
  26. IsOn = false
  27. Debounce[Player]:Destroy()
  28. end)
  29.  
  30. Player.Chatted:Connect(function(msg)
  31. if not IsOn then return end
  32. if Debounce2[Player] then return end
  33.  
  34. for i,v in pairs(game.Workspace.TeleportLocations:GetChildren()) do
  35. if msg:lower() == tostring(v.Name:lower()) then
  36. print(msg)
  37. local BottomPart = game.ReplicatedStorage.BottomPart:Clone()
  38. BottomPart.Position = Character.HumanoidRootPart.Position + Vector3.new(0,-3,0)
  39. Debounce2[Player] = BottomPart
  40. Character.Humanoid:LoadAnimation(script.SnapGate):Play()
  41.  
  42. local CircleTween = game.TweenService:Create(BottomPart, TweenInfo.new(1.2,Enum.EasingStyle.Sine,Enum.EasingDirection.In), {Size = Vector3.new(0.05, 5, 5)})
  43. BottomPart.Parent = workspace
  44. CircleTween:Play()
  45.  
  46. CircleTween.Completed:Connect(function()
  47. Character.HumanoidRootPart.Position = v.Position
  48. IsOn = false
  49.  
  50. Debounce[Player]:Destroy()
  51. BottomPart.Touched:Connect(function(Hit)
  52. if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Character then
  53. Hit.Parent.HumanoidRootPart.Position = v.Position
  54. end
  55. end)
  56.  
  57. local Reverse = game.TweenService:Create(BottomPart, TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.In), {Size = Vector3.new(0.05, 0.05, 0.05)})
  58. Reverse:Play()
  59. Reverse.Completed:Connect(function()
  60. Debounce2[Player]:Destroy()
  61. Debounce2[Player] = nil
  62. end)
  63.  
  64. end)
  65. end
  66. end
  67. end)
  68.  
  69. Debounce[Player] = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement