TP
TP
function GetShortenedPlrFromName(name)
name = string.lower(tostring(name))
for i, v in pairs(game.Players:GetPlayers()) do
if string.lower(string.sub(v.DisplayName, 1, #name)) == name or
string.lower(string.sub(v.Name, 1, #name)) == name then
return {v}
end
end
return nil
end
tool.Activated:Connect(function()
local mouse = LocalPlayer:GetMouse()
local target = mouse.Target
return tool
end
tool.Activated:Connect(function()
local mouse = LocalPlayer:GetMouse()
local targetPos = mouse.Hit.Position
if LocalPlayer.Character and
LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
LocalPlayer.Character:SetPrimaryPartCFrame(CFrame.new(targetPos +
Vector3.new(0, 3, 0)))
print("Teleported to clicked location")
end
end)
return tool
end
SelectPlayerButton.MouseButton1Click:Connect(function()
local tool = createPlayerSelectionTool()
if LocalPlayer.Character then
tool.Parent = LocalPlayer.Backpack
LocalPlayer.Character.Humanoid:EquipTool(tool)
end
end)
ClickTeleportButton.MouseButton1Click:Connect(function()
local tool = createClickTeleportTool()
if LocalPlayer.Character then
tool.Parent = LocalPlayer.Backpack
LocalPlayer.Character.Humanoid:EquipTool(tool)
end
end)
LocalPlayer.Character:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame
)
end
end
Input.FocusLost:Connect(function(enterPressed)
if enterPressed then
local players = GetShortenedPlrFromName(Input.Text)
if players and #players > 0 then
selectPlayer(players[1])
else
print("Player not found")
end
end
end)
TeleportButton.MouseButton1Click:Connect(function()
local players = GetShortenedPlrFromName(Input.Text)
if players and #players > 0 then
selectPlayer(players[1])
else
print("Player not found")
end
end)
-- Function to show UI
local function showUI()
local goal = {}
goal.Position = UDim2.new(1, -240, 0.5, -115) -- Adjusted position
local tween = TweenService:Create(TeleportFrame, TweenInfo.new(0.3,
Enum.EasingStyle.Quad, Enum.EasingDirection.Out), goal)
tween:Play()
ToggleButton.Text = "<"
isVisible = true
end
-- Function to hide UI
local function hideUI()
local goal = {}
goal.Position = UDim2.new(1, 0, 0.5, -115) -- Adjusted position
local tween = TweenService:Create(TeleportFrame, TweenInfo.new(0.3,
Enum.EasingStyle.Quad, Enum.EasingDirection.Out), goal)
tween:Play()
ToggleButton.Text = ">"
isVisible = false
end