You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I just want it to do something when I you type “Hail Felipe!”
What is the issue? Include screenshots / videos if possible!
It just doesn’t work at all, I don’t really know how to explain it.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have just tried different formatting and looked around on discord.
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!
local Player = game.Players.LocalPlayer
local Event = game.ReplicatedStorage.RemoteEvent
Player.Chatted:Connect(function(msg)
if msg == string.lower("Hail Felipe!") then
Event:FireServer(Player)
print("First one works...")
else
print("Not works")
end
end)
local Player = game.Players.LocalPlayer
local Event = game.ReplicatedStorage.RemoteEvent
Player.Chatted:Connect(function(msg)
local msg = "Hail Felipe!"
if msg:lower():sub(1,#msg) == msg then
Event:FireServer(Player)
print("First one works...")
else
print("Not works")
end
end)
or use this if you don’t want it to be exactly ‘Hail Felipe!’
local Player = game.Players.LocalPlayer
local Event = game.ReplicatedStorage.RemoteEvent
Player.Chatted:Connect(function(msg)
local msg = "Hail Felipe!"
if msg:lower():sub(1,#msg) == msg then
Event:FireServer(Player)
print("First one works...")
else
print("Not works")
end
end)
Have you tried lowercasing the player’s input? string.lower(msg) == "hail felipe!"
Have you also tried sanitizing the input by doing the following?
msg = msg:gsub("%c", "");
EDIT
Roblox a while back broke the chat, what happens is that when a player hits enter a control character gets added to the input. To sanitize this is to remove this said character. The pattern %c would remove said character with the gsub.