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

Update every frame?

Asked by
Exsius 162
9 years ago

Something similar to:

https://unity3d.com/learn/tutorials/modules/beginner/scripting/update-and-fixedupdate

what is the function in Roblox lua called?

1 answer

Log in to vote
5
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

The RenderStepped event of the RunService fires every frame, but in LocalScripts only.

While it is an event you can connect to normally, I usually see scripts that look like this:

while true do
    game["Run Service"].RenderStepped:wait()
    -- do whatever
end

I'm not really sure which would be considered "better", though I think the way with the loop is much more straightforward.

1
The loop method is probably faster than a function call, although `BindToRenderStep` allows *much* more control over the order of various RenderStepped'd functions. adark 5487 — 9y
Ad

Answer this question