FireClient: player argument must be a Player object

Oh no what did I do wrong. I keep getting this error:
FireClient: player argument must be a Player object
This is just a chunk of code from the script let me know if you need whole script to figure out what’s wrong.

placeObject.OnServerEvent:Connect(function(plr, objectName, posX, posZ)

	local foundObject = objects:FindFirstChild(objectName)

	

	if foundObject then

		local clonedObject = foundObject:Clone()

		

		init(clonedObject)

		place(clonedObject, posX, posZ)

		

		clonedObject.Parent = placedObjects

		clonedObject.Name = plr.Name.."object"

		RS.pro:FireClient(clonedObject)--error here

Rs is ReplicatedStorage and pro is the remote event

1 Like
placeObject.OnServerEvent:Connect(function(plr, objectName, posX, posZ)

	local foundObject = objects:FindFirstChild(objectName)

	

	if foundObject then

		local clonedObject = foundObject:Clone()

		

		init(clonedObject)

		place(clonedObject, posX, posZ)

		

		clonedObject.Parent = placedObjects

		clonedObject.Name = plr.Name.."object"

		RS.pro:FireClient(plr,clonedObject)--error here

you need to first pass a player object for fireclient(as the error says.) Easy fix

4 Likes

I would like to add that if you wanted to send a event to all the clients, you could use :FireAllClients(), which wouldn’t require a player argument.

2 Likes

Thank you for your help!! Luckily it was just an easy fix.

1 Like

Good to know I will remember that

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.