How to make floaty follower (edit) Without delay?
Asked by
5 years ago Edited 5 years ago
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
01 | local RunService = game:GetService( "RunService" ) |
02 | local Players = game:GetService( "Players" ) |
03 | local TweenService = game:GetService( "TweenService" ) |
04 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
07 | local part = Instance.new( "Part" ,c) |
08 | part.Size = Vector 3. new( 1 , 1 , 1 ) |
09 | part.Position = c.HumanoidRootPart.Position + c.HumanoidRootPart.CFrame.LookVector * - 2 + Vector 3. new( 0 , 2 , 0 ) |
15 | Players.PlayerAdded:Connect( function (player) |
16 | player.CharacterAdded:Connect( function (character) |
17 | local part = createPart(character) |
18 | local hRoot = character.HumanoidRootPart |
19 | local bodyPosition = Instance.new( "BodyPosition" ,part) |
20 | local bodyGyro = Instance.new( "BodyGyro" ,part) |
21 | local bodyAngle = Instance.new( "BodyAngularVelocity" ,part) |
22 | local offSet = Vector 3. new( 0 , 2 , 0 ) |
23 | while RunService.Heartbeat:Wait() do |
24 | bodyPosition.Position = hRoot.Position + hRoot.CFrame.LookVector * - 2 + offSet |