Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local localPlayer = Players.LocalPlayer
- local teleportInterval = 3
- local teleportEnabled = false
- local selectedTarget = nil
- local inFront = true
- -- GUI
- local gui = Instance.new("ScreenGui", localPlayer:WaitForChild("PlayerGui"))
- gui.Name = "TeleportGUI"
- gui.ResetOnSpawn = false
- -- ปุ่ม Menu สำหรับซ่อน/แสดง mainFrame
- local menuBtn = Instance.new("TextButton")
- menuBtn.Size = UDim2.new(0, 80, 0, 30)
- menuBtn.Position = UDim2.new(0, 10, 0, 10)
- menuBtn.Text = "Menu"
- menuBtn.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- menuBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- menuBtn.Font = Enum.Font.SourceSansBold
- menuBtn.TextSize = 20
- menuBtn.Parent = gui
- local isMainVisible = true
- local mainFrame = Instance.new("Frame")
- mainFrame.Size = UDim2.new(0, 280, 0, 320)
- mainFrame.Position = UDim2.new(0.5, -140, 0.5, -160)
- mainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- mainFrame.BorderSizePixel = 0
- mainFrame.Active = true
- mainFrame.Draggable = true
- mainFrame.Parent = gui
- menuBtn.MouseButton1Click:Connect(function()
- isMainVisible = not isMainVisible
- mainFrame.Visible = isMainVisible
- end)
- -- Title
- local title = Instance.new("TextLabel")
- title.Size = UDim2.new(1, 0, 0, 30)
- title.Text = "Auto Teleport Tool"
- title.TextColor3 = Color3.fromRGB(255, 255, 255)
- title.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- title.Parent = mainFrame
- -- Dropdown label
- local dropdownLabel = Instance.new("TextLabel")
- dropdownLabel.Size = UDim2.new(1, -20, 0, 20)
- dropdownLabel.Position = UDim2.new(0, 10, 0, 40)
- dropdownLabel.Text = "เลือกผู้เล่น:"
- dropdownLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- dropdownLabel.BackgroundTransparency = 1
- dropdownLabel.TextXAlignment = Enum.TextXAlignment.Left
- dropdownLabel.Parent = mainFrame
- -- Dropdown list (Scrollable)
- local dropdownFrame = Instance.new("ScrollingFrame")
- dropdownFrame.Size = UDim2.new(1, -20, 0, 90)
- dropdownFrame.Position = UDim2.new(0, 10, 0, 60)
- dropdownFrame.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
- dropdownFrame.BorderSizePixel = 0
- dropdownFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
- dropdownFrame.ScrollBarThickness = 6
- dropdownFrame.Parent = mainFrame
- local listLayout = Instance.new("UIListLayout")
- listLayout.SortOrder = Enum.SortOrder.LayoutOrder
- listLayout.Parent = dropdownFrame
- local padding = Instance.new("UIPadding")
- padding.PaddingTop = UDim.new(0, 4)
- padding.PaddingBottom = UDim.new(0, 4)
- padding.PaddingLeft = UDim.new(0, 4)
- padding.PaddingRight = UDim.new(0, 4)
- padding.Parent = dropdownFrame
- -- Interval input
- local intervalBox = Instance.new("TextBox")
- intervalBox.Size = UDim2.new(1, -20, 0, 30)
- intervalBox.Position = UDim2.new(0, 10, 0, 160)
- intervalBox.PlaceholderText = "วินาทีในการวาร์ป (default: 3)"
- intervalBox.Text = ""
- intervalBox.ClearTextOnFocus = false
- intervalBox.TextColor3 = Color3.fromRGB(0, 0, 0)
- intervalBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- intervalBox.Parent = mainFrame
- -- Front/Back Toggle
- local fbToggle = Instance.new("TextButton")
- fbToggle.Size = UDim2.new(0.45, -5, 0, 35)
- fbToggle.Position = UDim2.new(0.05, 0, 0, 200)
- fbToggle.Text = "ตำแหน่ง: ด้านหน้า"
- fbToggle.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
- fbToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
- fbToggle.Parent = mainFrame
- -- Active Toggle
- local toggleButton = Instance.new("TextButton")
- toggleButton.Size = UDim2.new(0.45, -5, 0, 35)
- toggleButton.Position = UDim2.new(0.5, 5, 0, 200)
- toggleButton.Text = "Status: Not Active"
- toggleButton.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
- toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- toggleButton.Parent = mainFrame
- -- Destroy Button
- local destroyBtn = Instance.new("TextButton")
- destroyBtn.Size = UDim2.new(1, -20, 0, 40)
- destroyBtn.Position = UDim2.new(0, 10, 0, 250)
- destroyBtn.Text = "Destroy Script"
- destroyBtn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
- destroyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- destroyBtn.Parent = mainFrame
- -- ฟังก์ชันรีเฟรชรายชื่อผู้เล่น
- local function refreshList()
- for _, child in ipairs(dropdownFrame:GetChildren()) do
- if child:IsA("TextButton") then
- child:Destroy()
- end
- end
- local count = 0
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer then
- count = count + 1
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.new(1, -10, 0, 25)
- btn.Text = player.Name
- btn.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- btn.Parent = dropdownFrame
- btn.MouseButton1Click:Connect(function()
- selectedTarget = player
- dropdownLabel.Text = "เลือกแล้ว: " .. player.Name
- end)
- end
- end
- dropdownFrame.CanvasSize = UDim2.new(0, 0, 0, count * 25 + 8)
- end
- Players.PlayerAdded:Connect(refreshList)
- Players.PlayerRemoving:Connect(refreshList)
- refreshList()
- -- ป้อนความถี่ teleport
- intervalBox.FocusLost:Connect(function()
- local val = tonumber(intervalBox.Text)
- if val and val > 0 then
- teleportInterval = val
- else
- intervalBox.Text = tostring(teleportInterval)
- end
- end)
- -- สลับวาปด้านหน้า/หลัง
- fbToggle.MouseButton1Click:Connect(function()
- inFront = not inFront
- fbToggle.Text = "ตำแหน่ง: " .. (inFront and "ด้านหน้า" or "ด้านหลัง")
- end)
- -- เปิด/ปิดระบบ teleport
- toggleButton.MouseButton1Click:Connect(function()
- teleportEnabled = not teleportEnabled
- if teleportEnabled then
- toggleButton.Text = "Status: Active"
- toggleButton.BackgroundColor3 = Color3.fromRGB(100, 200, 100)
- else
- toggleButton.Text = "Status: Not Active"
- toggleButton.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
- end
- end)
- -- ปุ่มลบ GUI และ script
- destroyBtn.MouseButton1Click:Connect(function()
- teleportEnabled = false
- gui:Destroy()
- script:Destroy()
- end)
- -- Loop Teleport อัตโนมัติ
- task.spawn(function()
- while true do
- if teleportEnabled and selectedTarget and selectedTarget.Character and selectedTarget.Character:FindFirstChild("HumanoidRootPart") then
- local char = localPlayer.Character
- if char and char:FindFirstChild("HumanoidRootPart") then
- local targetRoot = selectedTarget.Character.HumanoidRootPart
- local offset = inFront and (targetRoot.CFrame.LookVector * 3) or -(targetRoot.CFrame.LookVector * 3)
- char:MoveTo(targetRoot.Position + offset)
- end
- end
- task.wait(teleportInterval)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement