
Key Required

-- ServerScriptService/AdminTeleportToBase.lua
-- Uso: admin digita no chat: !teleportto base <PlayerName>
-- Regras:
-- 1) Apenas UserIds presentes em ADMINS podem usar o comando.
-- 2) Apenas jogadores em APPROVED_TESTERS podem ser teleportados.
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
-- CONFIGURAÇÃO
local ADMINS = { 12345678, 87654321 } -- substitua pelos UserIds dos admins/dono
local APPROVED_TESTERS = { 22222222, 33333333 } -- contas de teste autorizadas
local BASE_CFRAME = CFrame.new(0, 50, 0) -- ajuste a posição da sua base
local TELEPORT_COOLDOWN = 3 -- segundos debounce por admin
-- UTILITÁRIOS
local function isInList(list, userId)
for _, id in pairs(list) do
if id == userId then return true end
end
return false
end
-- Cria pasta de logs em ServerStorage (se não existir)
local logsFolder = ServerStorage:FindFirstChild("AntiAbuseLogs")
if not logsFolder then
logsFolder = Instance.new("Folder")
logsFolder.Name = "AntiAbuseLogs"
logsFolder.Parent = ServerStorage
end
local adminLastUse = {}
local function logAction(adminPlayer, targetPlayer, reason)
local time = os.date("%Y-%m-%d %H:%M:%S")
local entry = Instance.new("StringValue")
entry.Name = string.format("%s_%s", adminPlayer.UserId, tick())
entry.Value = string.format("[%s] Admin:%s(%d) teleportou %s(%d) - %s",
time, adminPlayer.Name, adminPlayer.UserId, targetPlayer.Name, targetPlayer.UserId, reason or "sem motivo")
entry.Parent = logsFolder
print(entry.Value)
-- opcional: aqui você pode também enviar para um webhook/serviço externo (se tiver)
end
local function teleportCharacterToBase(targetPlayer)
if not targetPlayer.Character then return false, "Sem character" end
local root = targetPlayer.Character:FindFirstChild("HumanoidRootPart")
if not root then return false, "HumanoidRootPart não encontrado" end
-- tentativa segura de teleporte
root.CFrame = BASE_CFRAME + Vector3.new(0, 3, 0)
return true
end
-- Comando via chat (forma simples)
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if not msg then return end
local lower = msg:lower()
-- comando: !teleportto base PlayerName
if string.sub(lower,1,13) == "!teleportto " then
-- checar admin
if not isInList(ADMINS, player.UserId) then
player:SendNotification({Title="Permissão negada", Text="Somente admins podem usar esse comando."})
return
end
-- debounce por admin
local last = adminLastUse[player.UserId]
if last and tick() - last < TELEPORT_COOLDOWN then
player:Kick("Uso de comando muito rápido. (Cooldown)")
return
end
adminLastUse[player.UserId] = tick()
-- parse
local args = {}
for token in string.gmatch(msg, "%S+") do
table.insert(args, token)
end
-- esperamos: args[1] = "!teleportto", args[2] = "base", args[3] = PlayerName
if #args < 3 then
player:SendNotification({Title="Uso incorreto", Text="!teleportto base <PlayerName>"})
return
end
local sub = args[2]:lower()
local targetName = args[3]
if sub ~= "base" then
player:SendNotification({Title="Subcomando inválido", Text="Use 'base'."})
return
end
local targetPlayer = Players:FindFirstChild(targetName)
if not targetPlayer then
player:SendNotification({Title="Alvo não encontrado", Text="Jogador offline ou nome errado."})
return
end
-- checar se o alvo é um tester aprovado
if not isInList(APPROVED_TESTERS, targetPlayer.UserId) then
player:SendNotification({Title="Alvo não autorizado", Text="Esse jogador não é um tester aprovado."})
return
end
-- teleport
local ok, err = pcall(function()
local success, reason = teleportCharacterToBase(targetPlayer)
if success then
logAction(player, targetPlayer, "teleport para base (teste)")
player:SendNotification({Title="Sucesso", Text="Jogador teleportado."})
targetPlayer:SendNotification({Title="Aviso", Text="Você foi teleportado para fins de teste."})
else
player:SendNotification({Title="Falha", Text="Não foi possível teleportar: "..(reason or "erro")})
end
end)
if not ok then
warn("Erro no teleporte:", err)
player:SendNotification({Title="Erro", Text="Ocorreu um erro ao executar o comando."})
end
end
end)
end)
Script em desenvolvimento!!!
It didnt work for me
@draxdrako0 vamos resolver agora,perdão!!!