Unless your Roblox account’s the Roblox account (which would honestly be awesome), John Doe, Jane Doe or whoever id 4 is, you’re going to have to enter your own user id as its own index in the dictionary. You can find a user’s id by going to their profile, and looking at the url.
17514438 is my user id, so I would add [17514438] = true to the admins dictionary.
I hope this helped. If you have any questions please don’t hesitate to ask.
i said admins list work, but msg dont.
and i make this [1,2,3,4] to hide admin friends
so msg still dont work
here is original script
--services
local Players = game:GetService("Players")
local SerStorage = game:GetService("ServerStorage")
local admins = {
[34485603] = true
}
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == "/cmd" and admins[player.UserId] then
print("yes")
end
end)
end)
--services
local Players = game:GetService("Players")
local SerStorage = game:GetService("ServerStorage")
local admins = {
[34485603] = true
}
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg:lower():sub(1,4) == "/cmd" and admins[player.UserId] then
print("yes")
end
end)
end)
There’s a couple of things that can be tried to see what’s happening.
Check if PlayerAdded is picking up the player; I would expect that it would, but ya never know.
Try changing the command prefix to a colon : or exclamation point !, I recall there being some issues back then with command scripts using the forward slash /.
If neither of those work, lemme know.
EDIT
I wouldn’t recommend going with the match approach, as doing that doesn’t take into account any additional arguments that a command may have.
A better solution would be to try @Darkmist101’s solution, or to use find and get the additional arguments after the prefix.
For example
local Prefix = ":";
local Msg = "!kill plr";
-- In code
local Pos = Msg:find(Prefix);
if (Pos ~= nil) then
Msg = Msg:sub(1 + Pos);
if (Msg:sub(1, 5) == "kill ") then
-- code
end
end