Talk Sistem don't work

hi, I work at a talk Sistem like in Camping, but it gives me 2 errors:

The first script is:

game.ReplicatedStorage.ChangeName.OnClientEvent:Connect(function(plr)
script.Parent.PlayerName.Text = plr.Name
end)

and the error is: 15:41:24.635 - Players.pro_developer213.PlayerGui.Message.MainFrame.MainScript:2: attempt to index nil with ‘Name’

the second script is:

game.ReplicatedStorage.ChangeImage.OnClientEvent:Connect(function(plr)
	local IsPlayer = plr:IsA("Player")
	local Image
	if IsPlayer then
		Image = game.Players:GetUserThumbnailAsync(plr.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size352x352)
	else
		if plr.Name == "William Afton" then
			Image = "rbxgameasset://Images/PurpleGui"
		end
	end
	script.Parent.ImageLabel.Image = Image
end)

and it errors this: 15:41:24.637 - Players.pro_developer213.PlayerGui.Message.MainFrame.MainScript:10: attempt to index nil with ‘IsA’

line 10 in that function is line 2

How I call it:

function SetMessage(Player,Message)
	ChangeName:FireAllClients(Player)
	SetVisible:FireAllClients(true)
	ChangeImage:FireAllClients(Player)
    Typewriter:__call(Message,2.5)
    wait(2)
    SetVisible:FireAllClients(false)
end

function CreatePlayer(Name)
	local Model = Instance.new("Model")
	Model.Name = Name
	return Model
end

local WilliamAfton = CreatePlayer("William Afton")
SetMessage(WilliamAfton,"Hello and welcome to Fredbear Family Dinner!")

OnClientEvent doesn’t receive the player argument. When the server calls FireClient on a RemoteEvent, the player argument is only meant to specify which players the event should be running for. You therefore can’t access the player argument. Pass another argument on the server for FireClient to fix your problem.

1 Like