Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables:
- local LPlayer = game.Players.LocalPlayer
- local PlayerCount = #game.Players:GetPlayers()
- local Toggled = false
- local TeamsState = false
- local Mouse = LPlayer:GetMouse()
- local connection
- local TPTo
- -- Instances:
- local ScreenGui = Instance.new("ScreenGui")
- local Frame = Instance.new("Frame")
- local Exit = Instance.new("TextButton")
- local ScrollingFrame = Instance.new("ScrollingFrame")
- local UIListLayout = Instance.new("UIListLayout")
- local Toggle = Instance.new("TextButton")
- local Open = Instance.new("TextButton")
- local Teams = Instance.new("TextButton")
- --Properties:
- ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- ScreenGui.ResetOnSpawn = false
- Frame.Parent = ScreenGui
- Frame.BackgroundColor3 = Color3.fromRGB(48, 48, 48)
- Frame.BackgroundTransparency = 0.200
- Frame.BorderSizePixel = 3
- Frame.Position = UDim2.new(0.0347648263, 0, 0.0559440553, 0)
- Frame.Size = UDim2.new(0, 315, 0, 209)
- Exit.Name = "Exit"
- Exit.Parent = Frame
- Exit.BackgroundColor3 = Color3.fromRGB(121, 121, 121)
- Exit.Position = UDim2.new(0.899581671, 0, 0, 0)
- Exit.Size = UDim2.new(0, 24, 0, 27)
- Exit.Font = Enum.Font.SourceSans
- Exit.Text = "X"
- Exit.TextColor3 = Color3.fromRGB(0, 0, 0)
- Exit.TextSize = 18.000
- ScrollingFrame.Parent = Frame
- ScrollingFrame.Active = true
- ScrollingFrame.BackgroundColor3 = Color3.fromRGB(68, 68, 68)
- ScrollingFrame.Position = UDim2.new(0.0470941886, 0, 0.0363145657, 0)
- ScrollingFrame.Size = UDim2.new(0, 194, 0, 192)
- UIListLayout.Parent = ScrollingFrame
- UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
- Open.Name = "Open"
- Open.Parent = ScreenGui
- Open.BackgroundColor3 = Color3.fromRGB(113, 113, 113)
- Open.Position = UDim2.new(0.0340681374, 0, 0.578088582, 0)
- Open.Size = UDim2.new(0, 98, 0, 41)
- Open.Style = Enum.ButtonStyle.RobloxRoundButton
- Open.Font = Enum.Font.Gotham
- Open.Text = "Open GUI"
- Open.TextColor3 = Color3.fromRGB(0, 0, 0)
- Open.TextSize = 17.000
- Open.Visible = false
- Toggle.Name = "Toggle"
- Toggle.Parent = Frame
- Toggle.BackgroundColor3 = Color3.fromRGB(191, 7, 7)
- Toggle.Position = UDim2.new(0.695238173, 0, 0.842105269, 0)
- Toggle.Size = UDim2.new(0, 88, 0, 23)
- Toggle.Text = "Not Toggled"
- Toggle.Font = Enum.Font.SourceSans
- Toggle.TextColor3 = Color3.fromRGB(0, 0, 0)
- Toggle.TextSize = 14.000
- Toggle.TextScaled = true
- Teams.Name = "Teams"
- Teams.Parent = Frame
- Teams.BackgroundColor3 = Color3.fromRGB(191, 187, 70)
- Teams.Position = UDim2.new(0.695238173, 0, 0.684210539, 0)
- Teams.Size = UDim2.new(0, 88, 0, 23)
- Teams.Font = Enum.Font.SourceSans
- Teams.Text = "Teams Off"
- Teams.TextColor3 = Color3.fromRGB(0, 0, 0)
- Teams.TextSize = 14.000
- Teams.TextScaled = true
- -- Do stuff now:
- local function CreateButton(Player)
- local TPbutton = Instance.new("TextButton")
- TPbutton.Name = "PlayerTP"
- TPbutton.Parent = ScrollingFrame
- TPbutton.BackgroundColor3 = Color3.fromRGB(50, 227, 101)
- TPbutton.Position = UDim2.new(0.0551102199, 0, 0.0909091011, 0)
- TPbutton.Size = UDim2.new(0, 148, 0, 23)
- TPbutton.Text = Player.Name
- TPbutton.TextSize = 11.000
- end
- local function RemoveButtons()
- for _, gui in pairs(LPlayer.PlayerGui:GetDescendants()) do
- if gui.Name == "PlayerTP" then
- gui:Destroy()
- end
- end
- end
- -- Initially create buttons on startup
- for _, Player in pairs(game.Players:GetChildren()) do
- if Player.Name ~= LPlayer.Name then
- CreateButton(Player)
- end
- end
- -- Create button for when someone joins
- game.Players.PlayerAdded:Connect(function(Player)
- if Player.Name ~= LPlayer.Name then
- CreateButton(Player)
- end
- end)
- -- Remove button when player joins
- game.Players.PlayerRemoving:Connect(function(Player)
- for _, PlayerGUI in pairs(ScreenGui:GetDescendants()) do
- if PlayerGUI.Name == "PlayerTP" then
- if PlayerGUI.Text == Player.Name then
- PlayerGUI:Destroy()
- end
- end
- end
- end)
- wait()
- -- Exit
- Exit.MouseButton1Click:Connect(function()
- Frame.Visible = false
- Open.Visible = true
- end)
- -- Open
- Open.MouseButton1Click:Connect(function()
- Frame.Visible = true
- Open.Visible = false
- end)
- -- Tp Toggle
- Toggle.MouseButton1Click:Connect(function()
- if Toggled == true then
- Toggled = false
- Toggle.Text = "Not Toggled"
- Toggle.BackgroundColor3 = Color3.fromRGB(191, 7, 7)
- wait()
- else
- Toggled = true
- Toggle.Text = "Toggled"
- Toggle.BackgroundColor3 = Color3.fromRGB(75, 227, 0)
- wait()
- end
- end)
- -- Teams Toggle
- Teams.MouseButton1Click:Connect(function()
- if TeamsState == false then
- TeamsState = true
- RemoveButtons()
- for _, plr in pairs(game.Players:GetPlayers()) do
- if plr.Team.Name ~= LPlayer.Team.Name then
- CreateButton(plr)
- end
- end
- Teams.Text = "TP Other Teams"
- wait()
- else
- TeamsState = false
- RemoveButtons()
- for _, Player in pairs(game.Players:GetPlayers()) do
- if Player.Name ~= LPlayer.Name then
- CreateButton(Player)
- end
- end
- Teams.Text = "TP All"
- wait()
- end
- end)
- game:GetService("RunService").Heartbeat:Connect(function()
- local Guis = LPlayer.PlayerGui:GetGuiObjectsAtPosition(Mouse.X, Mouse.Y)
- -- Button Click Stuff
- for _, gui in pairs(Guis) do
- if gui:IsA("GuiButton") then
- if gui.Name == "PlayerTP" then
- connection = gui.MouseButton1Click:Connect(function()
- TPTo = game.Players:FindFirstChild(gui.Text)
- LPlayer.Character.HumanoidRootPart.CFrame = TPTo.Character.HumanoidRootPart.CFrame
- connection:Disconnect()
- end)
- end
- end
- end
- -- TP Toggle functionality
- if Toggled == true then
- if TPTo ~= nil then
- LPlayer.Character:WaitForChild("HumanoidRootPart").CFrame = TPTo.Character.HumanoidRootPart.CFrame
- end
- end
- end)
Add Comment
Please, Sign In to add comment