diff --git a/script.lua b/script.lua index 2a7f478..2847000 100644 --- a/script.lua +++ b/script.lua @@ -295,9 +295,18 @@ function syncState() ping.syncState(setLocalState()) end -pm_refresh=false -function pmRefresh() - pm_refresh=true +do + local pm_refresh=false + function pmRefresh() + pm_refresh=true + end + + function doPmRefresh() + if pm_refresh then + PartsManager.refreshAll() + pm_refresh=false + end + end end function ping.syncState(tbl) @@ -1126,10 +1135,7 @@ function tick() animateTick() -- Check for queued PartsManager refresh - if pm_refresh then - PartsManager.refreshAll() - pm_refresh=false - end + doPmRefresh() -- End of tick -- old_state.health=player.getHealth() old_state.color_check=color_check