Im trying to make a part follow a player with smooth movement and least amount of lag. I have tried using cframe, tweening and welding. None have given me the desired effect. Heres an example of what I want the part to do https://i.gyazo.com/6df2a8ae62337b4da3139b7f55105478.mp4

Edit:So no I have a block following my player and it looks exactly as I want. The only issue now is that there is a decent delay between the player moving and the block starting to move. Here is the code and a gif to demonstrate. https://gyazo.com/b16234226916461ca073db4aa9497b70

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

function createPart(c)
	local part = Instance.new("Part",c)
	part.Size = Vector3.new(1,1,1)
	part.Position = c.HumanoidRootPart.Position + c.HumanoidRootPart.CFrame.LookVector * -2 + Vector3.new(0,2,0)
	return part
end



Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local part = createPart(character)
		local hRoot = character.HumanoidRootPart
		local bodyPosition = Instance.new("BodyPosition",part)
		local bodyGyro = Instance.new("BodyGyro",part)
		local bodyAngle = Instance.new("BodyAngularVelocity",part)
		local offSet = Vector3.new(0,2,0)
		while RunService.Heartbeat:Wait() do
			bodyPosition.Position = hRoot.Position + hRoot.CFrame.LookVector * -2 + offSet
		end
	end)
end)

4 comments

1

Probably the easiest way would be to use a BodyPosition and other body movers.

0

Even though that is a good way, I like to tween parts, no need for welding.

0

MrLonely1221 that works pretty good thanks. The only issue now is its lagging behind more than I would like

0

lag is probably because of the client lagging on the server.