--- By Cookie_Devlopper enjoy [ used AI to do this ]
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local CONFIG = {
MaxDistance = 500,
Offset = Vector3.new(0, 3, 0),
Enabled = true,
}
local function teleportToClick()
if not CONFIG.Enabled then return end
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
local rootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoid or not rootPart then return end
if humanoid.Health <= 0 then return end
local hit = mouse.Hit
if not hit then return end
local distance = (hit.Position - rootPart.Position).Magnitude
if distance > CONFIG.MaxDistance then
warn("too far (" .. math.floor(distance) .. " studs)")
return
end
local targetPosition = hit.Position + CONFIG.Offset
rootPart.CFrame = CFrame.new(targetPosition)
end
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.T then
teleportToClick()
end
end)
Comments
wpwpwowwowowo