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