-- Function to handle player chat messages local function onPlayerChat(player, message) -- Check if the message starts with "/set" if string.sub(message, 1, 4) == "/set" then -- Extract the number from the message local number = tonumber(string.sub(message, 6)) -- Check if the extracted number is valid if number then -- Log the number and player's username print("Player: " .. player.Name .. " | Number: " .. number) else -- The number is invalid, notify the player player:ChatNotify("Invalid number format. Usage: /set [number]") end end end -- Function to connect the player chat event local function onPlayerAdded(player) player.Chatted:Connect(function (message) onPlayerChat(player, message) end) end -- Connect the onPlayerAdded function to the PlayerAdded event game.Players.PlayerAdded:Connect(onPlayerAdded)