Hey,
I recently started learning into tables and I was creating a basic test problem and ran into an issue, I grabbed the UserId of a table and then printed text if they matched a userId in the table, and if not it would kick them.
However I ran into an issue, due to myself only recently learning tables I do not understand how to fix this issue.
So far here is my Script(Non-Local Script)
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if table.find(_G.Admins, plr.UserId) then
print('User '.. plr.Name ..', User ID '.. plr.UserId ..' is an admin.')
else
warn('User is not an admin!')
wait(1)
plr:Kick('User not admin.')
end
end)
end)
My table uses the _G global function.
I have my table stored in a different file named Globals and contains all my Global variables, so far the file contains the following:
_G.Admins = {'2596403567','0','1'}
_G.Prefix = '@'
It may be something to do with how the _G works i originally thought, however inserting the script without the _G as local Admins = {'0','2596403567','1'}
does not help as such I am stuck and searched through the devForum to no help.
The output on my output view is this:
User is not an admin! - Server - Script:10
Server Kick Message: User not admin. - Studio
Yet should output
User AllabyAIIaby, User ID 2596403567 is an admin.
I am really stuck on this and so require aid, thanks in advance, AllabyAIIaby.
(Yes, this is my first post.)