I want to use body gyro to make something face something but it is not working, here is my code
Folder = script.Parent.Parent
Soldier = script.Parent.Parent.Parent
Torso = Soldier.Torso
Face = Torso.BodyGyro
Force = Torso.BodyVelocity
Location = Torso.Position
Moving = Folder.Values.Moving
Values = Folder.Values
Workspace.ChildAdded:connect(function(instance)
if instance.Name == "Beacon" then
print ("Beacon added")
if instance.Owner.Value == Values.Owner.Value then
print (instance.Owner.Value.."'s Beacon")
TargetLocation = CFrame(instance.Position)
Moving.Value = true
while Moving.Value == true --[[and Location ~= TargetLocation]] do -- If Moving now is true and is not already at the target location
-- Play animation for legs?
Face.CFrame = CFrame.new(Torso.Position, CFrame(TargetLocation)) --Face target location
Force.velocity = Torso.CFrame.lookVector * 100 -- Move to target location
end
end
end
end)
Workspace.ChildRemoved:connect(function(instance)
if instance.Name == "Beacon" then
print ("Beacon added")
if instance.Owner.Value == Values.Owner.Value then
print (instance.Owner.Value.."'s Beacon")
TargetLocation = nil
Moving.Value = false
-- Stop animation
Face.CFrame = nil -- Will this stop it from facing the position, and just come to a rest, obviously still facing the position as it won't have changed, but it won't be 'bond' to it
Force.velocity = Torso.CFrame.lookVector * 0
end
end
end)
Output says:
12:56:32.159 - CFrame is not a valid member of BodyGyro
12:56:32.160 - Script 'Workspace.Soldier.Folder.Scripts.FinishedMove', Line 34
