• Way to use buttons on scoreboard.
    9 replies, posted
So I tried adding buttons to a scoreboard I made, but the PANEL:Think() function calls to fast for the button to actually work. Is there anyway around this?
Uh what? You are only suppose to create elements a single time. (?) Be more descriptive of the issue and post code if you do not mind.
The scoreboard has to clear itself and add items on Think so that it will update. So therefore the think function must be used.
But you don't clear it every frame, that's how you waste RAM and potentially crash the game. You only create your elements whenever something needs to be added.
I see plenty of scoreboards use think to update lol. But if Think is frowned apon, whats a good alternative?
[QUOTE=helix757;47299183]I see plenty of scoreboards use think to update lol. But if Think is frowned apon, whats a good alternative?[/QUOTE] It's not usage of Think that is frowned upon, it is recreating the scoreboard ( or a part of it ) every frame, or otherwise too frequently.
Well how can I do it without Think. Timers are too infrequent and there are not hooks for all of the items.
[QUOTE=helix757;47299513]Well how can I do it without Think. Timers are too infrequent and there are not hooks for all of the items.[/QUOTE] Did you even read my comment? Either way, generally you only want to rebuild your scoreboard when player count changes ( or team composition ).
I see what you are getting at. But, say I just had it rebuild only on open. When I do that, theres a bug. If a player leaves while viewing the scoreboard, your console gets flooded with NULL ENTITY. And yes I did an IsValid check.
[QUOTE=helix757;47299568]I see what you are getting at. But, say I just had it rebuild only on open. When I do that, theres a bug. If a player leaves while viewing the scoreboard, your console gets flooded with NULL ENTITY. And yes I did an IsValid check.[/QUOTE] It means that you do not have an IsValid check where it should be. And for that reason ( players exiting when the scoreboard is open ) you must rebuild it only when you need it, not only on open, or every frame/second.
Sorry, you need to Log In to post a reply to this thread.