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

BodyGyro won't work...?[1 more question]

Asked by 10 years ago
bg = script.Parent.BodyGyro
while true do
wait(0.1)
bg.cframe = CFrame.new(script.Parent.CFrame, game.Workspace.NoobKing.Torso.CFrame)
end

It won't look at NoobKing. Why? What's wrong with it?

1
Thanks for the CFrame.p part, but isn't BodyGyro supposed to have a 'cframe' property instead of 'CFrame'? ferseus 0 — 10y
1
Sorry you're right, that's a typo BlueTaslem 18071 — 10y

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

The two parameters to the 2-argument CFrame.new constructor are vectors, not coordinate frames.

Either use .Position or use the position component of the CFrame, .CFrame.p. Interestingly they are the same length (in characters) so I have no opinion as to which is better style.


bg.cframe = CFrame.new(script.Parent.Position,
game.Workspace.NoobKing.Torso.CFrame.p );
-- For example use, both are shown
-- For good style, you should pick one or the other and use it
-- for both

You should also be tabbing your code properly



EDIT: Fixed typo. BodyGyro's target orientation is cframe NOT CFrame as I had typed previously

Ad

Answer this question