The function it’s error at is:
Here it is in lua blocks since it’s got removed.
function FBan.AddAnonymeBan(player)
FBan.AnonymeBanned[player.Name] = true
end
Ok, can I see how your entire table is set up?
This is a nitpick, but you should use a :
and self
, if you’re gonna call a function that interacts with itself
Can you show me a fix of the function?
function FBan:AddAnonymeBan(player)
self.AnonymeBanned[player.Name] = true
end
FBan:AddAnonymeBan(Player) -- call it like this
It’s just syntax sugar.
Uhm. FBan is my module. So do I still put
self?
Also. I wanna it be able to work in others scripts.
It’s look like this:
FBan.AnonymeBanned = {}
Ok, and the error was something like attempt to index nil with "..."
?
The error was table index is nil
.
I’ve never seen that error before. But judging by the text shown, it’s probably saying that either FBan.AnonymeBanned
is nil
or FBan.AnonymeBanned[player.Name]
is nil
.
How would this be set to nil? I putted it to true:
Where do you call the function in your code?
I call it in another script. The script:
local FBan = require(game:GetService("ServerScriptService"):WaitForChild("FBanModule"))
FBan.AddAnonymeBan("achdef")
There’s your issue (I believe?), you send a string instead of Player
Instance which is what your function expects.
Do I just remove .Name
? Or no?
Yes, remove .Name
. You could also just add your name to the table by default for testing:
FBan.AnonymeBanned = {
['achdef'] = true,
}
It didn’t print because some type of error occurred before the print. Make sure to keep an eye on the output to debug errors.
The console is more good. I did only see the error on the console.