game:GetService("RunService").RenderStepped:connect(function() StandHR.CFrame = HR.CFrame * CFrame.new(0, 0, 2.5) end)
--- HR is a HumanoidRootPart
So if there is anyway to clone this and being seeable by all people?
game:GetService("RunService").RenderStepped:connect(function() StandHR.CFrame = HR.CFrame * CFrame.new(0, 0, 2.5) end)
--- HR is a HumanoidRootPart
So if there is anyway to clone this and being seeable by all people?
You can use a while loop to replace the RenderStepped function, though it'll be about half as fast so you should double the rate at which it moves. You can use either of the below methods to accomplish this.
Note that to replicate to other players, it'll have to be in a server script instead of a localscript.
while true do
StandHR.CFrame = HR.CFrame * CFrame.new(0, 0, 2.5)
wait()
end
-- OR
while wait() do
StandHR.CFrame = HR.CFrame * CFrame.new(0, 0, 2.5)
end
However, based on the context, a while loop - and even the heartbeat and renderstepped methods you were using before - probably wouldn't be very performance-friendly for your game, likely causing a lot of lag.
An alternative can be found in BodyMovers, which can be found here. What you should probably use is a BodyVelocity, which keeps a part in the air (unaffected by gravity) and moves it at a constant rate. Keep in mind this is totally optional, and if you have better success with the previous method, you can stick to it.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Make it not a local script...?
but if I will then it says that Heartbeat/RenderStepped can be run only from Local script
If you want to replicate for other clients you'll have to unanchor the "StandHR" part and on a server script set it's network ownership to the player using it.