Hello,
I need to make a loop so that a part follows you by using a loop but only for a couple of seconds. Does anyone know how to make a loop that only runs for a few seconds?
Hello,
I need to make a loop so that a part follows you by using a loop but only for a couple of seconds. Does anyone know how to make a loop that only runs for a few seconds?
Couldn’t you use tween instead
Tweening would be the amount of time it takes before it arrives to the player. Unless there’s a way I don’t know about.
You can do:
local Timer = 5
local WaitTime = 0.25
while Timer > 0 do
wait(WaitTime)
Timer -= WaitTime
end
I found an exact way of doing it right after you posted it, which is this;
function Follow(v)
local Player = v[1];
local Time = v[2];
for i = 0, Time*10 do
wait(0.01);
Part.CFrame = game:GetService("Players"):FindFirstChild(Player).Character:FindFirstChild("HumanoidRootPart").CFrame;
end;
end;
Follow({"Player1", 3})