10:44:10.192 Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this
And my script is
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local PosX
local PosY
local PosZ
local Model
local Button = script.Parent.TextButton
local GridSize = 2
local CanStart = true
local isPlacing = nil
local CanPlace = nil
local function Snap()
PosX = math.floor(Mouse.Hit.X / GridSize + 0.5) * GridSize
PosY = 3
PosY = math.floor(Mouse.Hit.Z / GridSize + 0.5) * GridSize
end
local function Placement()
if isPlacing and CanPlace then
local PlacedModel = Model:Clone()
PlacedModel.Parent = workspace.PlacedObjects
isPlacing = false
CanPlace = false
CanStart = true
Model:Destroy()
end
end
local function Movement()
Mouse.TargetFilter = Model
Snap()
Model:SetPrimaryPartCFrame(CFrame.new(PosX, PosY, PosZ))
end
local function StartPlacementWoodBlock()
if CanStart then
Model = game:GetService("ReplicatedStorage").WoodBlock:Clone()
Model.Parent = workspace
isPlacing = true
CanPlace = true
CanStart = false
Mouse.Move:Connect(Movement)
end
end
Mouse.Button1Down:Connect(Placement)
Button.MouseButton1Click:Connect(StartPlacementWoodBlock)
Simply specify the Primary Part. Go to model, click “Primarypart”, then your cursor should turn into a brick and you go into explorer and click the primary part you would like to select. Use a new part and make it sized as big as the whole model and create welds and turn off collisions, transparency to 1. If this doesn’t work then do: