Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.