local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local isKeyHeld = false
-- Create distance indicator GUI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local DistanceLabel = Instance.new("TextLabel")
DistanceLabel.Size = UDim2.new(0, 200, 0, 30)
DistanceLabel.Position = UDim2.new(0.5, -100, 0, 20)
DistanceLabel.BackgroundTransparency = 0.5
DistanceLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
DistanceLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
DistanceLabel.TextSize = 18
DistanceLabel.Font = Enum.Font.GothamBold
DistanceLabel.Visible = false
DistanceLabel.Parent = ScreenGui
-- Enhanced void detection
local function isSafeToTeleport(position)
local rayDirections = {
Vector3.new(0, -10, 0),
Vector3.new(2, -10, 2),
Vector3.new(-2, -10, -2),
Vector3.new(2, -10, -2),
Vector3.new(-2, -10, 2)
}
for _, direction in ipairs(rayDirections) do
local ray = Ray.new(position + Vector3.new(0, 5, 0), direction)
local hit = workspace:FindPartOnRay(ray, Player.Character)
if hit then
return true
end
end
return false
end
-- Show distance indicator
local function showDistance(distance)
DistanceLabel.Text = string.format("Teleported: %d studs", distance)
DistanceLabel.Visible = true
task.delay(1, function()
DistanceLabel.Visible = false
end)
end
-- Direct teleport function with safety check and distance display
local function teleportToMouse()
if Player.Character and Player.Character:FindFirstChild("HumanoidRootPart") then
local targetPos = Mouse.Hit.Position
if isSafeToTeleport(targetPos) then
local root = Player.Character.HumanoidRootPart
local startPos = root.Position
root.CFrame = CFrame.new(targetPos) + Vector3.new(0, 3, 0)
-- Calculate and show distance
local distance = (targetPos - startPos).Magnitude
showDistance(math.floor(distance))
end
end
end
-- Mouse click handling with key check
Mouse.Button1Down:Connect(function()
if isKeyHeld then
teleportToMouse()
end
end)
-- Key handling
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.F1 then
isKeyHeld = true
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.F1 then
isKeyHeld = false
end
end)
-- Character respawn handling
Player.CharacterAdded:Connect(function(newCharacter)
newCharacter:WaitForChild("HumanoidRootPart")
end)
To embed this project on your website, copy the following code and paste it into your website's HTML: