achdef
(blue)
April 2, 2021, 5:58pm
#1
Hello developers,
for unknown reasons even when I am in the anonyme banned table the gui wont clone and change the texts. Script:
Code blocks:
game.Players.PlayerAdded:Connect(function(player)
if FBan.AnonymeBanned[player.Name] == true then
local weirdEffect = game:GetService("ReplicatedStorage").AnonymeBan
local putWeirdEffect = weirdEffect:Clone()
putWeirdEffect.Parent = player.PlayerGui
wait(5)
player.PlayerGui.AnonymeBan.Frame.TextLabel.Text = "ERROR. CLIENT LOSTED!"
wait(5)
player.PlayerGui.AnonymeBan.Frame.BackgroundColor3 = Color3.new(0, 0, 0)
player.PlayerGui.AnonymeBan.Frame.Transparency = 0
wait(10)
player:Kick("System error has occured.")
end
end)
How is the table set up? Is it an array or a dictionary?
achdef
(blue)
April 2, 2021, 6:04pm
#3
It is a dictionary currently. And I prefer dictionary.
Ok, add this before the if
condition:
print(FBan.AnonymeBanned)
If it prints your name, are there any errors?
achdef
(blue)
April 2, 2021, 6:09pm
#5
It’s did not print it. That is so weird.
Is this a server script or a local script?
achdef
(blue)
April 2, 2021, 6:10pm
#7
A error in the console.
Table index is nil.
achdef
(blue)
April 2, 2021, 6:12pm
#8
The function it’s error at is:
achdef
(blue)
April 2, 2021, 6:13pm
#9
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
achdef
(blue)
April 2, 2021, 6:16pm
#11
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.
achdef
(blue)
April 2, 2021, 6:19pm
#13
Uhm. FBan is my module. So do I still put
self?
No .
Anyway, what does the table structure look like?
achdef
(blue)
April 2, 2021, 6:20pm
#15
Also. I wanna it be able to work in others scripts.
Ok, and the error was something like attempt to index nil with "..."
?
achdef
(blue)
April 2, 2021, 6:24pm
#18
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
.
achdef
(blue)
April 2, 2021, 6:30pm
#20
How would this be set to nil? I putted it to true: