uh
- User
uh
Assistant
你好!😊 你想问什么呢?无论是关于学习、生活、科技还是其他话题,我都很乐意帮你解答!
- User
make me roblox script that kicked player if he say words that start with "a" and "b" and "h"
Assistant
Here's a Roblox script that will kick a player if they say a word starting with "a", "b", or "h" in the chat:
local Players = game:GetService("Players") local function onPlayerChatted(player, message) -- Convert the message to lowercase for case-insensitive checking local lowerMessage = string.lower(message) -- Split the message into words local words = {} for word in string.gmatch(lowerMessage, "%S+") do table.insert(words, word) end -- Check each word for _, word in ipairs(words) do -- Check if the word starts with 'a', 'b', or 'h' if string.sub(word, 1, 1) == "a" or string.sub(word, 1, 1) == "b" or string.sub(word, 1, 1) == "h" then -- Kick the player player:Kick("You said a word starting with 'a', 'b', or 'h'!") return end end end -- Connect the chat event for each player local function onPlayerAdded(player) player.Chatted:Connect(function(message) onPlayerChatted(player, message) end) end -- Connect the PlayerAdded event Players.PlayerAdded:Connect(onPlayerAdded)How to Use:
- Open Roblox Studio.
- Go to ServerScriptService in the Explorer.
- Insert a new Script and paste the code above.
- Playtest your game to see it in action.
Notes:
- This script is case-insensitive (e.g., "Apple", "apple", "APPLE" will all trigger the kick).
- It checks each word in the message, not just the first word.
- The player will be kicked immediately if any word starts with "a", "b", or "h".
Would you like any modifications, such as adding a warning before kicking or excluding certain words? 😊
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.