wait(1)
local event = nil;
local name = nil;
event.OnServerEvent:Connect(function()
for _,plr in pairs(game.Players:GetPlayers()) do
print("Running Sources")
event = plr:WaitForChild("PlayerGui").CoreGui.KickPlayer:WaitForChild("Remote Kick")
repeat
wait()
until
event
name = event.Parent:WaitForChild("PlayerName")
print("a")
if game:FindFirstChild(name.Text) then
print("b")
game.Players[name.Text].Character:Remove()
print("c")
wait()
print("d")
game.Players[name.Text].PlayerGui.CoreLoadingGui.Error.Visible = true
print("e")
game.Players[name.Text].PlayerGui.CoreLoadingGui.Error.ErrorText.Text = "[ CLIENT DISCONNECTED ]: You have been kicked from this game."
print("f")
end
end
end)
COMMUNITY QUESTION
Keep getting the error, "event" is nil I don't know why?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

8 comments
because you set the variable "event" nil ;-;
That is not the reason, I could set local nil and it still would give me the error.
"event" is nil because you said "event = nil" and didn't set it to something that's not nil
Uhhh, because event is nil at the start and you're attempting to use it
Line 8
16:22:00.986 - ServerScriptService.Event Reciever:5: attempt to index local 'event' (a nil value)
"local event = nil" therefore it will return nil
Oh my gosh... I feel so dumb