Why do i get the error "attempt to index nil with 'clone""

I want to clone the object the player is currently placing so that it appears on the server-side. I’m getting the error I said in the title with the following code:
‘’’
local PlaceObject = game.ReplicatedStorage.BuildEvents.PlaceObject

local function PlaceObjectServer(X, Y, Z, obj, plt, Rot)

local Object = game.ReplicatedStorage.BuildObjects:FindFirstChild(“obj”):Clone()

Object:SetPrimaryPartCFrame(CFrame.new(X, Y, Z) * CFrame.Angles(0, math.rad(Rot), 0))

Object.Parent = plt

end

PlaceObject.OnServerEvent:Connect(PlaceObjectServer)
‘’’
The obj = the Object.Name(Which is a model)

If obj is a variable, don’t use quotations in FindFirstChild()

Ok I’ll try that… i hope it works

i still got the error. Can you help me solve this problem

You would only be getting that error if game.ReplicatedStorage.BuildObjects:FindFirstChild(“obj”) was nil. Double check your paths.

Object.Name, PosX, PosY, PosZ,
That was in the FireServer

if you do any server connection event with remote events ALWAYS put player as the first parameter

local PlaceObject = game.ReplicatedStorage.BuildEvents.PlaceObject

local function PlaceObjectServer(player, X, Y, Z, obj, plt, Rot)

local Object = game.ReplicatedStorage.BuildObjects:FindFirstChild("obj"):Clone()

Object:SetPrimaryPartCFrame(CFrame.new(X, Y, Z) * CFrame.Angles(0, math.rad(Rot), 0))

Object.Parent = plt

end

PlaceObject.OnServerEvent:Connect(PlaceObjectServer)

Is the “player” on client side when I Fire the function or server side when i receive it???

yes its because the player or the client fired it so if you have player as arguments in your FireServer event remove the player argument

Thanks, it worked out well. That was the solution