Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UIS = game:GetService("UserInputService")
- local player = Players.LocalPlayer
- -- GUI
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = player:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Parent = screenGui
- frame.Size = UDim2.new(0, 220, 0, 160)
- frame.Position = UDim2.new(0.5, -110, 0.5, -80)
- frame.BackgroundColor3 = Color3.fromRGB(35,35,35)
- frame.BorderSizePixel = 0
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0,12)
- corner.Parent = frame
- -- Title
- local title = Instance.new("TextLabel")
- title.Parent = frame
- title.Size = UDim2.new(1,0,0,35)
- title.BackgroundTransparency = 1
- title.Text = "Teleport GUI"
- title.TextScaled = true
- title.Font = Enum.Font.GothamBold
- title.TextColor3 = Color3.new(1,1,1)
- -- Spawn Button
- local spawnButton = Instance.new("TextButton")
- spawnButton.Parent = frame
- spawnButton.Size = UDim2.new(0.85,0,0,45)
- spawnButton.Position = UDim2.new(0.075,0,0.32,0)
- spawnButton.Text = "Teleport To Spawn"
- spawnButton.TextScaled = true
- spawnButton.Font = Enum.Font.GothamBold
- spawnButton.BackgroundColor3 = Color3.fromRGB(0,170,255)
- spawnButton.TextColor3 = Color3.new(1,1,1)
- local spawnCorner = Instance.new("UICorner")
- spawnCorner.CornerRadius = UDim.new(0,10)
- spawnCorner.Parent = spawnButton
- -- House Button
- local houseButton = Instance.new("TextButton")
- houseButton.Parent = frame
- houseButton.Size = UDim2.new(0.85,0,0,45)
- houseButton.Position = UDim2.new(0.075,0,0.67,0)
- houseButton.Text = "Teleport To House"
- houseButton.TextScaled = true
- houseButton.Font = Enum.Font.GothamBold
- houseButton.BackgroundColor3 = Color3.fromRGB(255,100,100)
- houseButton.TextColor3 = Color3.new(1,1,1)
- local houseCorner = Instance.new("UICorner")
- houseCorner.CornerRadius = UDim.new(0,10)
- houseCorner.Parent = houseButton
- -- Dragging
- local dragging = false
- local dragInput
- local dragStart
- local startPos
- local function update(input)
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(
- startPos.X.Scale,
- startPos.X.Offset + delta.X,
- startPos.Y.Scale,
- startPos.Y.Offset + delta.Y
- )
- end
- title.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1
- or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- title.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement
- or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- UIS.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- -- Teleport Function
- local function teleport(cf)
- local character = player.Character or player.CharacterAdded:Wait()
- local hrp = character:WaitForChild("HumanoidRootPart")
- hrp.CFrame = cf + Vector3.new(0,5,0)
- end
- -- Spawn TP
- spawnButton.MouseButton1Click:Connect(function()
- teleport(workspace.SpawnLocation.CFrame)
- end)
- -- House TP
- houseButton.MouseButton1Click:Connect(function()
- local target = workspace.Houses.House_15.Build.Frames:GetChildren()[3]
- if target:IsA("BasePart") then
- teleport(target.CFrame)
- elseif target:IsA("Model") then
- local part = target.PrimaryPart or target:FindFirstChildWhichIsA("BasePart")
- if part then
- teleport(part.CFrame)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment