Invalid number of arguments on CFrame

I am trying to weld a mesh to the player with a certain position and rotation, but I get an error saying:
“Invalid number of arguments: 4”

  local Model = game.ReplicatedStorage.Model()
        Model.Parent = Player.Character.UpperTorso
        Model.CFrame = Player.Character.UpperTorso.CFrame
        local newWeld = Instance.new("Weld")
        newWeld.Parent = Player.Character.UpperTorso
        newWeld.Part0 = Player.Character.UpperTorso
    newWeld.Part1 = Model
    local newVector3 = Vector3.new(-0,540,0.405,-0.364)
    newWeld.C0 = CFrame.new(newVector3)
    newWeld.C1 = CFrame.Angles(89.5, math.rad(0), -89.46)
    end)

Does anyone know how to fix this?
(Note: the part is not actually named Model)

1 Like

I believe you put a comma instead of a decimal point.

    local newVector3 = Vector3.new(-0.540,0.405,-0.364)

I have changed this in the script, but the position and rotation are still not being set, though it did fix the error.

Unfortunately, there doesn’t seem to be enough information.

For welding I recommend using the new Rigid Constraints which uses attachments. It’s a lot easier to setup and debug due to the use of attachments to visualize. Although internally Rigid Constraints uses the same maths as welds.

I’ve changed the script to use RigidConstraint, but now I can’t set a position and rotation, and it has not attached to the right place.

Rigid constraint is based on attachments, so you can set the Attachments position and rotation to modify it further.