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

How would I make this follow parts/players without a humanoid?

Asked by 7 years ago
01hungries = script.Parent
02 
03 
04 
05function findTarget()
06    for _,v in pairs(game.Workspace:GetChildren()) do
07        if v:IsA("Part") then
08            magnitude = (hungries.Position - v.Position).magnitude
09           print(magnitude)
10 
11local b = Instance.new('BodyAngularVelocity')
12b.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
13b.angularvelocity = Vector3.new(0, magnitude, 0)
14b.Parent = hungries
15 
View all 25 lines...

I dont have a humanoid in the model so I cant use MoveTo(). Atm it prints any random magnitude but I will add a findnearest part bit to it in the future. Also do parts and players share a common variable that could make it follow both? thx

1 answer

Log in to vote
0
Answered by
noammao 294 Moderation Voter
7 years ago

try to make the script to change the camera subject to the part and change the camera type to follow. for example:

1game.workspace.CurrentCamera.CameraSubject = Part
2cam.CameraType = Enum.CameraType.Follow
Ad

Answer this question