I want to make a part follows the player and also looks at the player. I can only make the part looks at the player by using CFrame.lookat funtion but it only looks at the player but it doesn’t follow the player movement. The part is basically stuck in one place. I tried coding many different methods but I always ended up not in successful results. Does anyone know how to do that in a code?
You can use RunService and tween the part to the plays cframe
1 Like
local part = part_that_follows_player
local player = player_to_be_followed
local rootPart = player.Character.HumanoidRootPart
local OFFSET = studs_behind_the_player (positive)
With that out of the way, run the following in a Heartbeat loop:
part.CFrame = CFrame.lookAt((rootPart.CFrame * CFrame.new(0, 0, OFFSET)).Position, rootPart.Position)
1 Like
You saved me alot of time! Thanks alot!
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.