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

Vector3 expected, got CFrame?

Asked by
Netflixy 126
8 years ago
Edited 8 years ago

The lines of code below, gives me this output:

Players.Player1.PlayerGui.LocalScript:25: bad argument #1 to 'new' (Vector3 expected, got CFrame)

        local a = new()
        local b = new()
        local c = new()
        a.Name = "Name"
        b.Name = "Usage"
        c.Name = "Desc"
        b.Rotation = Vector3.new(Char.Torso.Rotation.X, Char.Torso.Rotation.Y+90, Char.Torso.Rotation.Z)
        b.CFrame = CFrame.new(Char.Torso.CFrame*CFrame.new(0,0,-4.6)) --Line 25

Can anyone please help, and also explain why this is happening?

1 answer

Log in to vote
1
Answered by 8 years ago

The problem is that you are trying to construct a CFrame from another CFrame, which doesn't work. To fix this, just remove the call to CFrame.new:

local a = new()
local b = new()
local c = new()
a.Name = "Name"
b.Name = "Usage"
c.Name = "Desc"
b.Rotation = Vector3.new(Char.Torso.Rotation.X, Char.Torso.Rotation.Y+90, Char.Torso.Rotation.Z)
b.CFrame = Char.Torso.CFrame*CFrame.new(0,0,-4.6)
Ad

Answer this question