How do I get a userid from a modulescript?

I feel like its complicated, I wanna make a blacklist script taking the usersid from a module.
Module

local blacklist = {
	[1] = {
		["Test"] = 131504927,
	}
}

return blacklist

LocalScript

local Module = require(script.Parent.Module)

local Player = game:GetService("Players")
local Directory = script.Parent

if Player.LocalPlayer.UserId == Module[1] then
	Directory.Alert.Enabled = false
	Directory.Info.Enabled = false
	Directory.MEF.Enabled = false
	Directory.PlayerList.Enabled = false
	Directory.Scoreboard.Enabled = false
	
	game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
	
	Player.LocalPlayer.Backpack:ClearAllChildren()
end
1 Like

Why dont you just have the blacklist set up as an array?

local Blacklist = {
 11111 -- userid
}

return Blacklist

Then you can just check if that userID is blacklisted by doing this:

local UserID = game:GetService("Players").LocalPlayer.UserID

if table.find(Blacklist, UserID) then
 -- do whatever
end

blacklist would redline, what am i missing that should be defined?

That was just an example so that you could set up your own variables but you need to make sure the blacklist module is defined somewhere.

local Blacklist = require(...) -- replace with whatever path you have it under

local UserID = game:GetService("Players").LocalPlayer.UserID

if table.find(Blacklist, UserID) then
 -- do whatever
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.