Why isn't this tool working?

Okay. For a few days now I have been struggling to make this work, tried multiple forum posts, nothing has worked. I will just show everything I got and hope someone can help.

What it is suppose to do: Place a chair, with the lego pegs on top

What the issue is: The chair goes underground and the pegs go on ground?

https://gyazo.com/e10a25b7a961634b5e73fe281d0ffad0

And it won’t even move, it is suppose to place where I click. After trying it on the side of my baseplate I noticed the pegs switch with other blocks.

Here is what I have:

In ReplicatedStorage:
image

In ServerScriptService:
image

In StarterPack:
image

Now my code

Server Script:


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

-- PlaceBlock Event

Event.OnServerEvent:Connect(function(plr,target,pos,Block)
	local xBlock = Block:Clone()
	--local model = xBlock
	local model = game.ReplicatedStorage.ChairTrap
	xBlock.Trap.Position = target.Position + pos
	xBlock.Parent = game.Workspace
	model.PrimaryPart = model.Trap
	model:SetPrimaryPartCFrame(xBlock.Trap.CFrame)
	print(target)
end)

Client:

-- Variables

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local position = mouse.Hit.p
local UIS = game:GetService('UserInputService')
local RS = game:GetService('ReplicatedStorage')
local tool = script.Parent
local Event = RS:WaitForChild('PlaceBlock')
local pos
local Chair = game.ReplicatedStorage.ChairTrap
local LegoPegs = game.ReplicatedStorage.ChairTrap.Union
local ChairTrap = Chair and LegoPegs
local model = game.ReplicatedStorage.ChairTrap

model.PrimaryPart = model.Trap

-- Surface Detection

local function Surface(surface)
	if surface.Name == "Top" then
		local position = mouse.Hit.p
		print(surface.Name)
		print(position)
		pos = Vector3.new(position.X,0,position.Z)
	elseif surface.Name == "Bottom" then
		local position = mouse.Hit.p
		pos = Vector3.new(position.X,0,position.Z)
	elseif surface.Name == "Front" then
		local position = mouse.Hit.p
		pos = Vector3.new(position.X,0,position.Z)
	elseif surface.Name == "Back" then
		local position = mouse.Hit.p
		pos = Vector3.new(position.X,0,position.Z)
	elseif surface.Name == "Left" then
		local position = mouse.Hit.p
		pos = Vector3.new(position.X,0,position.Z)
	elseif surface.Name == "Right" then
		local position = mouse.Hit.p
		 pos = Vector3.new(position.X,0,position.Z)
	end
	return pos
end




-- Place Block

script.Parent.Activated:Connect(function()
	local target = mouse.Target
	if target then
		local surface = mouse.TargetSurface
		local pos = Surface(surface)
		Event:FireServer(target,pos,Chair)
	end
end)

What is happening to it? I need more info

The block is placing under the map when the pegs are above

I need them to place together so it makes a lego brick.

Ok is it a model? Or no :slight_smile:

Yes, yes it is a model, shown here

Ok so the ChairTrap are you calling the Block then ChairTrap

You do not need to do this

model.PrimaryPart = --code
--just do
model:SetPrimaryPartCFrame(--code)
1 Like

Okay, but wouldn’t there still be a problem?

Not sure what you mean, if you mean what is in the model then the model name is ChairTrap, inside the model is a chair named Trap, and a Union called union which has the lego pegs

Does it show errors in the output?

No, no it doesn’t it places just not correctly

Send me the 2 scripts of your tool and I will try and fix it then send a rbxm file to send to you ok :slight_smile:

Want me just send you the rbxm file?

How much space they take up? I do not have much space lol

Brb Ima delete some old files lol

tool.rbxm (15.8 KB)

Ok lemme just empty my recycle bin on my pc 1 sec

Ok I am doing it. Sorry for the hold up

It is a notepad lol Is it meant to be