Attempt To index nil with name?

i am tryna make mute command and i keep getting this error

		local plr = game.Players:FindFirstChild(script.Parent.Parent.PlayerName.Text)
		local MuteModule = require(game.Workspace.Infinite.Main.Commands.Moderating.Mute)
		MuteModule.Execute("coolman21627", plr)

button script

local module = {
	CommandName = "Mute",
	Description = "stops a player from talking.",
	CanUseOn = "Player"

function module.Execute(AdminName, Player)
	local ChatService = require(

	local Channel = ChatService:GetChannel("All")
	for _, speakerName in ipairs(Channel:GetSpeakerList()) do

return module


Can you send a screenshot of the error. And at which script of this is it failing?

this is the
Workspace.Infinite.Main.Commands.Moderating.Mute:16: attempt to index nil with ‘Name’ - Server - Mute:16

but if i make either script have name it gives me the error

here script

Playername.Text isnt a valid member of player, instead it’s simply just player.Name

thats the textbox name though i so idk

Oh, text box name, show me where the local script is located.

its a server script because of require cos idk if local works with require


Module is in workspace aswell idk if that breaks it

That isn’t the way to get the player, if the text is the player’s username it won’t get the player, use game.Players.LocalPlayer instead.

server script that wont work… idk

Then use player added and get the plr parameter.

its an admin panel it isnt supposed to affect the player who is an admin

if plr.Name == "coolman21627" then
		local MuteModule = require(game.Workspace.Infinite.Main.Commands.Moderating.Mute)
MuteModule.Execute("coolman21627", plr)

Just a simple if statement and you’re good to go!

ill just redo it but idk why it wont work

Don’t put the module script in workspace, put it in serverscriptservice! It’s quite unsafe in workspace and exploiters can easily exploit with that.

That’s not true, it doesn’t really make a difference.

As far as the rest of this thread goes, it’s because Player is nil. Possibly @coolman21627 didn’t type the full player name with the correct capitalization.