Trying to make it where when a Player presses 'Q', the model clones to the workspace and the player can place it wherever they please on a 1 stud increment. I keep getting the error: "Unable to cast double to CoordinateFrame"
local model = game.ReplicatedStorage.Model local mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:connect(function(key) if key == "q" then local newModel = model:Clone() newModel.Parent = game.Workspace newModel:SetPrimaryPartCFrame(mouse.X,mouse.Y) end end)
The SetPrimaryPartCFrame
requires a CFrame value but instead you gave it two values; mouse.X,
and mouse.Y
If you're trying to move it by 1 stud increments, you're going to have to use math.floor
or math.ceil
local model = game.ReplicatedStorage.Model local mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:connect(function(key) if key == "q" then local newModel = model:Clone() newModel.Parent = game.Workspace newModel:SetPrimaryPartCFrame(CFrame.new(math.floor(mouse.Hit.p.X),math.floor(mouse.Hit.p.Y),math.floor(mouse.Hit.p.Z))) end end)
That should work.