-- Серверный скрипт в ServerScriptService
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if string.sub(message, 1, 5) == "/tp " then
local targetPlayerName = string.sub(message, 6) -- Get the name after /tp
local targetPlayer = game.Players:FindFirstChild(targetPlayerName)
if targetPlayer then
local targetChar = targetPlayer.Character
if targetChar then
local targetRootPart = targetChar:FindFirstChild("HumanoidRootPart")
if targetRootPart then
local char = player.Character
if char then
local rootPart = char:FindFirstChild("HumanoidRootPart")
if rootPart then
rootPart.CFrame = targetRootPart.CFrame
print(player.Name .. " телепортировался к " .. targetPlayerName)
else
print("У игрока " .. player.Name .. " не найден HumanoidRootPart")
end
else
print("У игрока " .. player.Name .. " не найден персонаж")
end
else
print("У игрока " .. targetPlayerName .. " не найден HumanoidRootPart")
end
else
print("У игрока " .. targetPlayerName .. " не найден персонаж")
end
else
print("Игрок " .. targetPlayerName .. " не найден")
end
end
end)
end)