Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Get A Part Follow Player With No Lag?

Asked by 9 years ago

Hello, I need a part to follow the player's torso with absolutely no lag. I have tried BodyPosition, but I need it to constantly follow where the player is, so I have to reset the position in a loop with a 0.01 interval, but I don't think Roblox can handle that interval... so how do I make it follow the player where it is without lag? Also, I there any other method that isn't welding, because I need to rotate the arms also.

1
You can still rotate welded parts using CFrames aquathorn321 858 — 9y

2 answers

Log in to vote
1
Answered by 9 years ago

The following script uses rocket propulsion to fire a projectile that follows the player by using brick welded above the player as a target. Keep in mind you might have to change the MaxSpeed and MaxThrust values of the rocket depending on the outcome you want and the weight of the part.

01local p = Instance.new("Part")
02p.FormFactor = "Custom"
03p.BottomSurface = "Smooth"
04p.TopSurface = "Smooth"
05p.Size = Vector3.new(3,3,3)
06local c = Instance.new("RocketPropulsion",p)
07c.Name = "rocket"
08 
09 
10 
11game.Players.PlayerAdded:connect(function(player)
12    player.Character:connect(function(character)
13        local u = p:Clone()
14        u.Size = Vector3.new(0,0,0)
15        u.Cancollide = false
View all 27 lines...
Ad
Log in to vote
0
Answered by 9 years ago
01local plr = game.Players.LocalPlayer
02local char = plr.Character or plr:CharacterAdded:wait()
03 
04while wait() do
05local part = script.Parent
06local t = char.Torso
07 
08part.Position = t.Position
09 
10end)

Answer this question