Chaseycoil

Universal Player Teleporter

Aug 15th, 2025 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.73 KB | Source Code | 0 0
  1. -- Full Smooth LoopTP Executor GUI with Behind Offset
  2.  
  3. local Players = game:GetService("Players")
  4. local RunService = game:GetService("RunService")
  5. local player = Players.LocalPlayer
  6.  
  7. local loopActive = false
  8. local targetPlayer
  9. local speed = 0.2 -- Smoothness
  10.  
  11. -- Default behind offset (in studs)
  12. local behindOffset = -5
  13.  
  14. -- ScreenGui
  15. local ScreenGui = Instance.new("ScreenGui")
  16. ScreenGui.Parent = player:WaitForChild("PlayerGui")
  17.  
  18. -- Main Frame
  19. local Frame = Instance.new("Frame")
  20. Frame.Size = UDim2.new(0, 280, 0, 220)
  21. Frame.Position = UDim2.new(0.5, -140, 0.5, -110)
  22. Frame.BackgroundColor3 = Color3.fromRGB(40,40,40)
  23. Frame.BorderSizePixel = 0
  24. Frame.Active = true
  25. Frame.Draggable = true
  26. Frame.Parent = ScreenGui
  27.  
  28. -- Close Button (X = close completely)
  29. local CloseButton = Instance.new("TextButton")
  30. CloseButton.Size = UDim2.new(0,30,0,30)
  31. CloseButton.Position = UDim2.new(1,-35,0,5)
  32. CloseButton.BackgroundColor3 = Color3.fromRGB(170,0,0)
  33. CloseButton.Text = "X"
  34. CloseButton.TextColor3 = Color3.new(1,1,1)
  35. CloseButton.Parent = Frame
  36.  
  37. -- Minimize Button (-)
  38. local MinButton = Instance.new("TextButton")
  39. MinButton.Size = UDim2.new(0,30,0,30)
  40. MinButton.Position = UDim2.new(1,-70,0,5)
  41. MinButton.BackgroundColor3 = Color3.fromRGB(255,170,0)
  42. MinButton.Text = "-"
  43. MinButton.TextColor3 = Color3.new(1,1,1)
  44. MinButton.Parent = Frame
  45.  
  46. -- Mini GUI button when minimized
  47. local MiniFrame = Instance.new("TextButton")
  48. MiniFrame.Size = UDim2.new(0,50,0,50)
  49. MiniFrame.Position = UDim2.new(0,20,0,20)
  50. MiniFrame.BackgroundColor3 = Color3.fromRGB(0,170,255)
  51. MiniFrame.Text = "⚡TP"
  52. MiniFrame.TextColor3 = Color3.new(1,1,1)
  53. MiniFrame.Visible = false
  54. MiniFrame.Parent = ScreenGui
  55. MiniFrame.Active = true
  56. MiniFrame.Draggable = true
  57.  
  58. -- Target username TextBox
  59. local TextBox = Instance.new("TextBox")
  60. TextBox.Size = UDim2.new(0,200,0,30)
  61. TextBox.Position = UDim2.new(0,25,0,50)
  62. TextBox.BackgroundColor3 = Color3.fromRGB(60,60,60)
  63. TextBox.TextColor3 = Color3.new(1,1,1)
  64. TextBox.PlaceholderText = "Enter username..."
  65. TextBox.ClearTextOnFocus = false
  66. TextBox.Parent = Frame
  67.  
  68. -- Behind distance TextBox
  69. local OffsetBox = Instance.new("TextBox")
  70. OffsetBox.Size = UDim2.new(0,200,0,30)
  71. OffsetBox.Position = UDim2.new(0,25,0,90)
  72. OffsetBox.BackgroundColor3 = Color3.fromRGB(60,60,60)
  73. OffsetBox.TextColor3 = Color3.new(1,1,1)
  74. OffsetBox.PlaceholderText = "Behind distance (studs, negative)"
  75. OffsetBox.ClearTextOnFocus = false
  76. OffsetBox.Text = tostring(behindOffset)
  77. OffsetBox.Parent = Frame
  78.  
  79. -- Start Button
  80. local StartButton = Instance.new("TextButton")
  81. StartButton.Size = UDim2.new(0,100,0,30)
  82. StartButton.Position = UDim2.new(0,25,0,140)
  83. StartButton.Text = "Start TP"
  84. StartButton.BackgroundColor3 = Color3.fromRGB(0,170,0)
  85. StartButton.TextColor3 = Color3.new(1,1,1)
  86. StartButton.Parent = Frame
  87.  
  88. -- Stop Button
  89. local StopButton = Instance.new("TextButton")
  90. StopButton.Size = UDim2.new(0,100,0,30)
  91. StopButton.Position = UDim2.new(0,155,0,140)
  92. StopButton.Text = "Stop TP"
  93. StopButton.BackgroundColor3 = Color3.fromRGB(170,0,0)
  94. StopButton.TextColor3 = Color3.new(1,1,1)
  95. StopButton.Parent = Frame
  96.  
  97. -- Close/Minimize Logic
  98. CloseButton.MouseButton1Click:Connect(function()
  99.     ScreenGui:Destroy()
  100. end)
  101.  
  102. MinButton.MouseButton1Click:Connect(function()
  103.     Frame.Visible = false
  104.     MiniFrame.Visible = true
  105. end)
  106.  
  107. MiniFrame.MouseButton1Click:Connect(function()
  108.     Frame.Visible = true
  109.     MiniFrame.Visible = false
  110. end)
  111.  
  112. -- Helper: find player
  113. local function getPlayer(name)
  114.     for _, p in pairs(Players:GetPlayers()) do
  115.         if p.Name:lower() == name:lower() or p.DisplayName:lower() == name:lower() then
  116.             return p
  117.         end
  118.     end
  119.     return nil
  120. end
  121.  
  122. -- Smooth LoopTP behind target
  123. local function smoothLoopTP()
  124.     RunService.RenderStepped:Connect(function()
  125.         if loopActive and targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
  126.             local char = player.Character
  127.             local targetHRP = targetPlayer.Character.HumanoidRootPart
  128.             if char and char:FindFirstChild("HumanoidRootPart") then
  129.                 local current = char.HumanoidRootPart.Position
  130.                 local offsetNum = tonumber(OffsetBox.Text) or behindOffset
  131.                 local offset = targetHRP.CFrame.LookVector * offsetNum
  132.                 local goalPos = targetHRP.Position + offset
  133.                 char.HumanoidRootPart.CFrame = CFrame.new(current:Lerp(goalPos, speed))
  134.             end
  135.         end
  136.     end)
  137. end
  138.  
  139. -- Buttons actions
  140. StartButton.MouseButton1Click:Connect(function()
  141.     local name = TextBox.Text
  142.     local target = getPlayer(name)
  143.     if target then
  144.         targetPlayer = target
  145.         loopActive = true
  146.         smoothLoopTP()
  147.         print("Smooth LoopTP started to "..target.Name)
  148.     else
  149.         warn("Player not found")
  150.     end
  151. end)
  152.  
  153. StopButton.MouseButton1Click:Connect(function()
  154.     loopActive = false
  155.     print("LoopTP stopped")
  156. end)
  157.  
Advertisement
Add Comment
Please, Sign In to add comment