When the player enters the game, their screen would literally be white everywhere, no floors, no walls, and it would be just a limitless space where you can technically walk forever.
where you can walk forever
I would achieve above by putting a small invisible platform below the player, and use while loops to reposition the platform to below the player for every loop.
That got me thinking, this below is what I would be using for the script:
while task.wait() do
--reposition the platform to below the player
end
but there’s also this option that should work too:
hrp.Changed:Connect(function()
--reposition the platform to below the player
end)
Which of the codes above would be more performant if I were to use it to reposition my platform to below the player?
This is because Lua has an optimisation where if a loop’s condition is the true keyword, Lua will continue the while loop without running a conditional check on the loop, unless there is a break call
Also adding something here even though it’s been solved: please don’t use RenderStepped for anything except the camera or updating a property of the character (i.e. LocalTransparencyModifier of parts in them or a CFrame property). Go with Heartbeat instead.
Running expensive code in RenderStepped can result in slowed render execution because RenderStepped needs to complete before a frame renders. In nearly all cases of using RunService you should be using Heartbeat. You can use Stepped if your computations need to happen before physics get simulated and RenderStepped if and only if you need something to happen before the frame renders and there are a rare number of scenarios where that case is ever met.