Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

CFraming Primary Part to Mouse.Hit isnt working? Expecting Vector3?

Yeah so just need a model to follow your mouse. All seems to work except for the model actually moving with your mouse. Here is the error Workspace.CrispyBrix.GasBomb.Call:12: bad argument #1 to 'new' (Vector3 expected, got CFrame)

local function onActivate()
	local hover = mouse.Hit
	local clo = game.ReplicatedStorage.Marker:Clone()
	clo.Parent = workspace
	clo.Name = player.Name .. "sMarker"
	while tool.Parent == player.Character do
		wait()
		clo:SetPrimaryPartCFrame(CFrame.new(hover))
	end
	
end

I don't understand because I tried switching it to Vector3.new but I got a different error saying something about it can't convert it to a coordinate frame. Which makes sense, but what doesnt make sense to me is this error, anyone know what im doing wrong? Any help is appreciated :)

1 answer

mouse.Hit is already a CFrame (wiki) so you cannot put a CFrame inside a CFrame, so you'll probably just have to do clo:SetPrimaryPartCFrame(hover)

This discussion is preserved as it was. New answers, comments, and votes are closed.