Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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)

Ad

Answer this question