Module Script :
local module = {}
local plr = game.Players.LocalPlayer
local data = game:GetService("DataStoreService")
local bandata = data:GetDataStore("banned")
local usid = plr.UserId
--//functions\\--
game.Players.PlayerAdded:Connect(function()
local banned
local succes, errormessage = pcall(function()
bandata:GetAsync(usid)
end)
if banned == true then
plr:Kick("You are banned")
end
end)
function module.ban(usid)
local success, errormessage = pcall(function()
bandata:SetAsync(usid, true)
end)
if success then
print(usid + " Banned.")
end
end
end
return module
OutPut :
Workspace.nematknprotect.Credit.SettingsAyarlar:13: attempt to index nil with 'UserId'
Please help!

3 comments
is the module script required by a localscript? or server script?
server script
That will be why. If a module is used by a server script, it acts like a server script