RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"teleport chat command for only players who has bool value of Guardian."
-- server script (ServerScriptService) local Players = game:GetService("Players") local function onChat(player, message) if player.Guardian.Value then local args = string.split(message, " ") if args[1] == "!teleport" and args[2] and args[3] then local targetPlayer = Players:FindFirstChild(args[2]) local destinationPlayer = Players:FindFirstChild(args[3]) if targetPlayer and destinationPlayer then local targetChar = targetPlayer.Character local destinationChar = destinationPlayer.Character if targetChar and destinationChar then local destinationPos = destinationChar.HumanoidRootPart.Position targetChar.HumanoidRootPart.CFrame = CFrame.new(destinationPos) end end end end end Players.PlayerChatted:Connect(onChat)