Build System script not working?

I am trying to make a building script however I ran into an issue. I tried to debug it but couldn’t figure out the issue either.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local model = game.ReplicatedStorage.WoodCrate
local gridSize = 2
local cratebutton = script.Parent:WaitForChild("brick").TextButton
local allowed = false
local x 
local y
local z
local canPlace = nil
local isPlace = nil
local canStart = nil
local function grid()
	x = math.floor(mouse.Hit.X / gridSize) * gridSize
    y = crate.PrimaryPart.Position.Y
	z = math.floor(mouse.Hit.Z / gridSize + 0.5) * gridSize
end


local function move()
	mouse.TargetFilter = crate
	grid()
	crate:SetPrimaryPartCFrame(CFrame.new(x,y,z))
	
end
	
local function placingObject() -- placing the object
	if canPlace and isPlace then
				local mod0 = model:Clone()
		mod0.Parent = workspace.objFolder
			 canStart = true
			isPlace = false
				canPlace = false
			end
		end

local function ChoosingPlacement() --  choosing where to place the object
	    if canStart then
      	local mod1 = model:Clone()
		mod1.Parent = workspace
		print("wroksapce")
			canStart = false
			canPlace = true
			isPlace = true
		
		mouse.Move:Connect(move)
	end
end

cratebutton.MouseButton1Click:Connect(function(ChoosingPlacement)
	mouse.Button1Down:Connect(function(placingObject)
	end)
end)```
cratebutton.MouseButton1Click:Connect(function(ChoosingPlacement)
	mouse.Button1Down:Connect(function(placingObject)
	end)
end)

I believe this is your issue, your connecting the event to a new function instead of your current ones.

Which is why nothing is running.

Removed the “function” part, but doesn’t seem to be running anything either.

Do you have any errors in the output?

Got the error figured out now, my bad.