Advertisement
SxScripting

Snap Gate WIth 20% Rate

Dec 26th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local Info = TweenInfo.new(2, Enum.EasingStyle.Sine)
  3.  
  4. local v2 = {Size = Vector3.new(0.05, 7, 7)}
  5. local v3 = {Size = Vector3.new(0.05,0.05,0.05)}
  6.  
  7. game.Players.PlayerAdded:Connect(function(Player)
  8. Player.Chatted:Connect(function(msg)
  9. for i,v in pairs(game.Workspace.TeleportLocations:GetChildren()) do
  10. if msg:lower() == v.Name then
  11. local LoadAnim = Player.Character.Humanoid:LoadAnimation(script.SnapGate)
  12. local TeleportPad = game.ReplicatedStorage.TeleportPad
  13. local TPD = TeleportPad:Clone()
  14.  
  15. local Chance = math.random(0,100)
  16. local Percetange = 20
  17.  
  18. local function Passed()
  19. if Chance < Percetange then
  20. return true
  21. else
  22. return false
  23. end
  24. end
  25.  
  26. Player.Character.Humanoid.WalkSpeed = 0
  27. Player.Character.Humanoid.JumpPower = 0
  28.  
  29. TPD.Position = Player.Character.HumanoidRootPart.Position + Vector3.new(0,-3,0)
  30. TPD.Parent = workspace
  31. LoadAnim:Play()
  32. local Tweenv1 = TweenService:Create(TPD, Info, v2)
  33. Tweenv1:Play()
  34.  
  35. TPD.Touched:Connect(function(Hit)
  36. if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and Passed() == true then
  37. Hit.Parent.HumanoidRootPart.Position = v.Position
  38. elseif Passed() == false and Hit.Parent ~= Player.Character then
  39. Hit.Parent.HumanoidRootPart.Position = game.Workspace.ForbiddinPart.Position
  40. end
  41. end)
  42.  
  43. Tweenv1.Completed:Connect(function()
  44. if Passed() == true then
  45. Player.Character.HumanoidRootPart.Position = v.Position
  46. wait(1)
  47. local Reversev1 = TweenService:Create(TPD, Info, v3):Play()
  48. Player.Character.Humanoid.WalkSpeed = 16
  49. Player.Character.Humanoid.JumpPower = 50
  50. TPD:Destroy()
  51. else
  52. Player.Character.HumanoidRootPart.Position = game.Workspace.ForbiddinPart.Position
  53. wait(1)
  54. local Reversev1 = TweenService:Create(TPD, Info, v3):Play()
  55. Player.Character.Humanoid.WalkSpeed = 16
  56. Player.Character.Humanoid.JumpPower = 50
  57. TPD:Destroy()
  58. end
  59. end)
  60. end
  61. end
  62. end)
  63. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement