RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"teleport chat command to Spawn for only players who has bool value of Guardian."
-- server script local Players = game:GetService("Players") local function onPlayerChatted(player, message) if message:lower() == "!teleport" then local character = player.Character if character and player:FindFirstChild("Guardian") and player.Guardian.Value == true then local spawnLocation = game.Workspace.Spawn character.HumanoidRootPart.CFrame = CFrame.new(spawnLocation.Position) end end end local function onPlayerAdded(player) player.Chatted:Connect(function(message) onPlayerChatted(player, message) end) end Players.PlayerAdded:Connect(onPlayerAdded) for _, player in ipairs(Players:GetPlayers()) do onPlayerAdded(player) end