Solution at the bottom!

Basically, whenever I run the following script, I always receive this error in the output --

Line 12: Unable to cast double to CoordinateFrame

Since there's not much explaining I can do, here's the code --

local mouse = game.Players.LocalPlayer:GetMouse()
local xcurr = game.ReplicatedStorage.CameraHandlers.Xcurr
local debounce = false

mouse.KeyDown:connect(function(key)
	if string.byte(key) == 32 then -- Space
		if not debounce then
			debounce = true
			local spawn = game.ReplicatedStorage.Model1:Clone()
			spawn.Parent = game.Workspace
			spawn.PrimaryPart = spawn:FindFirstChild("Torso")
			spawn:SetPrimaryPartCFrame(xcurr.Value, 19.9, 32.5)
			debounce = false
		end
	end
end)

I've tried replacing "xcurr.Value" with a regular number, to no avail. I've not really tampered with PrimaryPart and all of that, so I've not really developed a debugging affinity for its errors.

Thanks for reading, and I look forward to learning more on the subject.

EDIT: For anybody else who has this issue in the future, I solved this issue by doing this -- "spawn:SetPrimaryPartCFrame(CFrame.new(xcurr.Value, 19.9, 32.5))"

2 comments

0

ty

0

Thanks!