- What do you want to achieve? Keep it simple and clear!
- I want to achieve a way to check if a certain word is inside my list of pre-made command aliases
- What is the issue? Include screenshots / videos if possible!
- I’m aware of %s but it doesnt seem to fit my needs for this particular issue
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
- Searching it up on google and experimenting in-studio
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
antibreakcmd = {
"ayo, teleport %s here",
"ayo, tp %s to me",
"ayo, please bring %s over here"
}
So above me is a piece of code that I want to implement for my command. I wanna somehow check if the command is equal to any of the above aliases. And for that I will need to have something that tells the code that the chat message is equal to any of the cmd aliases. Example:
Example
Let’s say someone typed:
[Any Admin]: ayo, teleport PLAYER to me
this would teleport PLAYER to the admin. I already have a function for teleporting the player btw, and checking if the string is correct although not with the player argument implemented. Here is the script btw:
Check if the command matches with the chat string
function CheckCmd(msg, Type, user)
print(msg) -- message from user
print(user) -- user who send message
print(Type) -- the list of command aliases
for _, correct in ipairs(Type) do
print(correct)
if msg == correct then
return true
end
end
return false
end
Command format if u need it
And also this:
if CheckCmd(msg, antibreakcmd, speaker) then --Chat Command
--My teleport script is in here.
end
Sincerely,
Dev_Mathe