Trying to place multiple blocks not working

I am trying to make a lego trap chair, basically the placement works fine but the lego pegs don’t work

It places way under the ground

What it looks like: image

How it should look: image

Code:
– Variables

local RS = game:GetService('ReplicatedStorage')
local Event = RS:WaitForChild('PlaceBlock')

-- PlaceBlock Event

Event.OnServerEvent:Connect(function(plr,target,pos,Block, Block2)
	local xBlock = Block:Clone()
	local cBlock = Block2:Clone()
	local model = xBlock
	xBlock.Position = target.Position + pos
	xBlock.Parent = game.Workspace
	cBlock.Position = target.Position + pos
	cBlock.Position = cBlock.Position + Vector3.new(0, cBlock.Position.Y + 0.488, 0)
	cBlock.Parent = model
	print(target)
end)

Maybe try this. It seems like your positioning could be odd since it is changing it multiple times at once.

Event.OnServerEvent:Connect(function(plr,target,pos,Block, Block2)
	local xBlock = Block:Clone()
	local cBlock = Block2:Clone()
	local model = xBlock
	xBlock.Position = target.Position + pos
	xBlock.Parent = game.Workspace
	cBlock.Position = target.Position + pos + Vector3.new(0, 0.488, 0)
	cBlock.Parent = model
	print(target)
end)

Progress, it is now spawned inside the block instead of on top.

Play around with that 0.488 number (increasingly) until it is the position you wish. That ought to do the trick!

Thank you, I have another issue though the main brick spawns under the map sometimes any ideas?

Usually setting CFrame is better for placement systems, such as your own. I would take a look at the CFrame Documentation. Secondly, the parts should be anchored (I would think?). If they aren’t maybe try anchoring them so they aren’t strangely affected by physics/collisions.

They are anchored, and here is a example of them going threw the map. https://gyazo.com/c12c7311c5b31e7cf47b0f63bb442dff

Were you in play mode? That video looked as if you were in studio flying around! Correct me if I am wrong. :grinning_face_with_smiling_eyes: Anyways, you can add an offset on the Y axis (as I showed before with the stud parts) in order to ensure parts are fully above ground.

Yes, I was in play mode, thanks for the suggestion!

Wouldn’t a Y offset mess with it though, say the user is trying to place it on a more elevated part?

You can use TargetSurface in order to determine which face of a part the user is hovering over.

I am currently using that and it does not work…