Alright guys, mayor issue here;
For one of my announcement scripts I'm using a ChatService function to see if a user is a certain rank in my group, or if his name is on the whitelist. I'm unsure if my system is protected against exploiters who might abuse it, so I'm asking for any advice if there is any.
My script:
local prefix = "-ann "
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if plr:GetRankInGroup(123456) >= 100 or plr.Name == "RegisteredCode" then
if string.sub(msg, 1, 5) == prefix then
local ann = string.sub(msg, 6);
for i,v in pairs (game.Players:GetPlayers()) do
local gui = script.messageGui:Clone();
gui.Parent = v.PlayerGui;
gui.msg.TextLabel.Text = ann;
end
wait(6)
for i,v in pairs (game.Players:GetPlayers()) do
v.PlayerGui.messageGui:Destroy();
end
end
end
end)
end)
Some might see several issues already, perhaps by the way I format my code or using double for loops. Any suggestions are more than welcome.
Cheers!

4 comments
If the script containing the code is a server script, the client can't do anything.
It is in fact a server script, so this would mean my announcements are secure and can in no way be fired by random players?
Yes
Awesome, thanks