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 6 years ago
hungries = script.Parent



function findTarget()
    for _,v in pairs(game.Workspace:GetChildren()) do
        if v:IsA("Part") then
            magnitude = (hungries.Position - v.Position).magnitude
           print(magnitude)

local b = Instance.new('BodyAngularVelocity')
b.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
b.angularvelocity = Vector3.new(0, magnitude, 0)
b.Parent = hungries

        end
    end
end



while true do
    wait(1)
    findTarget()
end

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
6 years ago

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

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

Answer this question