LookVector Cant be Assigned

Hello, So I’m working on a script that requires a certain ball hold using a weld. I’ve ran into a problem where I get a error every time I run the game called “LookVector Cant be Assigned” and I don’t know why I am getting this error. Please Help!

Function:

-- Functions --
function M6D(Parent,Name,Part0,Part1,C0,C0Or,C1,C1Or)
	local Motor = Instance.new('Weld',Parent)
	Motor.Name = Name
	Motor.Part0 = Part0
	Motor.Part1 = Part1
	Motor.C0 = C0
	Motor.C0.LookVector = {['Orientation'] = C0Or}
	Motor.C1 = C1
	Motor.C1.LookVector = {['Orientation'] = C1Or}
end

Main:

M6D(Jersey,'JerseyWeld',Torso,Jersey,CFrame.new(0,0,0),Vector3.new(0,0,0),CFrame.new(0,0,0),Vector3.new(0,0,0))
					M6D(RightArm,'Connect',RightArm,nil,CFrame.new(0,-1,0),Vector3.new(-90,0,0),CFrame.new(0.2,0.2,0.3),Vector3.new(26.881,-59.502,25.246))

ScreenShot:

You cant Assign a LookVector to something else, its Basically the Vector3 the Object is facing

Theres a property under the C’s called Orentation. Is there a way I can set them in the script since I cant use LookVector?

you set the entire cframe, not the look vector specifically.

it seems you want the new cframe to have the position of C0 and a lookvector of C0Or. so to make this cframe you can use

Motor.C0 = CFrame.lookAt(C0.Position, C0.Position + C0Or) 
Motor.C1 = CFrame.lookAt(C1.Position, C1.Position + C1Or) 
2 Likes

It flips around the values when I do that

what kind of values are you passing for C0Or and C1Or?

These are what the values are suppost to be.
image
But in game when I do spawn one into the char it
it changes everything
image

Oh ok, i misunderstood. try this

local C0OrRad = C0Or*math.pi/180
Motor.C0 = CFrame.fromOrientation(C0OrRad.X, C0OrRad.Y, C0OrRad.Z) + C0.Position

local C1OrRad = C1Or*math.pi/180
Motor.C1 = CFrame.fromOrientation(C1OrRad.X, C1OrRad.Y, C1OrRad.Z) + C1.Position

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.