Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED] Why does my script not finding the Players that were specified?

So I'm trying to secure my authentication system (No, it's not for malicious purposes and it can only be accessed by certain people)

And I ran into an error that I couldn't seem to fix, basically what I want is when I click a Btn, it fires a RemoteEvent, then the Server receives the event, then it calls a ModuleScript function and that ModuleScript processes the rest.

Here is the script:

Client:

if Events.Moderation.Disconnect then
	Events.Moderation.Disconnect:FireServer(plr, plr.Name, "Multiple login attempt")
end

Server:

Moderation_Folder.Disconnect.OnServerEvent:Connect(function(Mod, Target, Reason)
	if not table.find(Admins, Mod.UserId) then
		InternalMod:Ban("Game", Mod.Name, "Unauthorized Event/Attempted Breach")
		return
	end
	
	print("e")
	InternalMod:Disconnect(Mod, Target, Reason)
end)

Module:

local Players = game:GetService("Players")

function InternalAdmin:Disconnect(Mod, Target, Reason)
	print(Target)
	print(Mod.Name)
	local T = Players:FindFirstChild(Target)
	print(Players:FindFirstChild(Target))
	print(T.Name)
	
	if T then
		T:Kick("Force-Disconnected")
	else
		return "Target couldn't be found"
	end
end

Is everything in this script defined? Yes.

Have I tested it in the Roblox Player? Yes.

What have I tried so far? Nothing since I have no idea where to start

Did it print anything? only Target and T.Name don't print, the rest does.

Have I searched the internet for my problem? Yes, no luck.

Did it get the name correct? Absolutely.

Here are a few pictures:

Output

Players

1 answer

I forgot that FireServers already have the players...

This discussion is preserved as it was. New answers, comments, and votes are closed.