Can somebody help to fix a bug with the raft building?

Local Script:

local player = game.Players.LocalPlayer  
local mouse = player:GetMouse()  
local modelToPlace = game.ReplicatedStorage:WaitForChild("Raft")

local markerModel = modelToPlace:Clone()
markerModel.Parent = game.Workspace  
markerModel:SetPrimaryPartCFrame(CFrame.new(0, -1000, 0))
markerModel.WoodenRaft.Transparency = 0.2
markerModel.WoodenRaft.CanCollide = false


local function roundToStuds(position)  
	return Vector3.new(  
		math.floor(position.X + 0.5),
		math.floor(position.Y + 0.5),
		math.floor(position.Z + 0.5)
	)  
end  

local function updateMarker()   
	local rayOrigin = mouse.Hit.p + Vector3.new(0, 10, 0) 
	local rayDirection = Vector3.new(0, -15, 0)
	local raycastParams = RaycastParams.new()  
	raycastParams.FilterDescendantsInstances = {markerModel}
	raycastParams.IgnoreWater = true

	local hit = workspace:Raycast(rayOrigin, rayDirection, raycastParams)  

	if hit and hit.Instance:IsA("BasePart") and hit.Instance.Name == "CanPlace" then  
		markerModel:SetPrimaryPartCFrame(CFrame.new(roundToStuds(hit.Position + Vector3.new(0, markerModel.PrimaryPart.Size.Y / 2, 0))))   
	else  
		markerModel:SetPrimaryPartCFrame(CFrame.new(0, -1000, 0))
	end  
end  

local function placeModel()   
	local rayOrigin = markerModel.PrimaryPart.Position + Vector3.new(0, 10, 0)  
	local rayDirection = Vector3.new(0, -15, 0)  
	local raycastParams = RaycastParams.new()  
	raycastParams.FilterDescendantsInstances = {markerModel}  
	raycastParams.IgnoreWater = true  

	local hit = workspace:Raycast(rayOrigin, rayDirection, raycastParams)  

	if hit and hit.Instance:IsA("BasePart") and hit.Instance.Name == "CanPlace" then  

		local newModel = modelToPlace:Clone()  
		local placementPosition = roundToStuds(hit.Position + Vector3.new(0, newModel.PrimaryPart.Size.Y / 2, 0))
		newModel:SetPrimaryPartCFrame(CFrame.new(placementPosition)) 
		game.ReplicatedStorage.RemoteEvents.Build:FireServer(player,placementPosition,modelToPlace)  
	else  
		print("Need part CanPlace!")  
	end  
end  

mouse.Button1Down:Connect(function()  
	placeModel()
end)  

game:GetService("RunService").RenderStepped:Connect(updateMarker)
-- there are no errors

Server Script:

local function roundToStuds(position)  
	return Vector3.new(  
		math.floor(position.X + 0.5),
		math.floor(position.Y + 0.5),
		math.floor(position.Z + 0.5)
	)  
end  

local modelToPlace = game.ReplicatedStorage.Raft

game.ReplicatedStorage.RemoteEvents.Build.OnServerEvent:Connect(function(plr,placementPosition)
	local newModel = modelToPlace:Clone()  
	newModel:SetPrimaryPartCFrame(CFrame.new(placementPosition)) -- Error here
	newModel.Parent = game.Workspace
end)

Error:

Everything seems to be correct, idk what’s wrong

Is the 2nd script you posted named “Building”? The error shows that’s the script that has an error in line 12.
If it is then possibly newModel isn’t a good name for the variable since new is used in Luaa.
Try just renaming the variable.

It’s even saying ‘new’, maybe the placementPosition isn’t a valid vector3.

This is your line 12. The only ‘new’ in the line is the variable Just try changing it’s name to nooModel or something you can relate to.

you fire from the client with player, while on the server the player parameter is defined automatically, so placementPosition is actually the player argument from your client script

nvm, I’m a little dumb and didn’t realize that I was using the wrong variable