I tried inserting logical prints in between every line of code seen here, and I have also tested both in game and in test mode. The rest of the code works perfectly without the dependency of this code, however, this piece of code is important to initiate raids.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
--Argument for group requirement
Player.Chatted:Connect(function(Message)
if string.lower(Message) == ":official" then
--Official function
end
end)
end)
By logical I mean prints like: print(Player) or print(Message)
I haven’t tried this method for prefixes. However I don’t see how this will fix the function being entirely non-functional for me. It goes from working a week ago to not working after never being touched/changed.
This works! It seems that Roblox would rather you split up prefixes and messages and have them separate. This use to not be the case a week or two ago. Thank you for the help.
The issue was that your original code was checking if the text was exactly “:official”, rather than checking if it started with “:official”. It’s not about what Roblox wants/would rather have; it’s about what your code functionally does versus what you intend it to do.
After staying up all night I have deduced that this code is foolproof:
game.Players.PlayerAdded:Connect(function(Player)
--if Player meets requirements then
Player.Chatted:Connect(function(Message)
if Message:sub(1,1) ~= "!" then
return
end
local Command = Message:match('%a+')
local Variables = Message:sub(#Command+2)
if Command:lower() == "official" and not Official.Value then
--Pass along argument
end
end)
end
end)