Is there a better way I could do this scoreBoardGui?

In my screen gui I have scripts that manage the games/matches, but since this is cloned in each players playerGui is this a problem? Everything works, but I don’t want to get into a bad habit or break the game when there are many players. Here is a model of the screen gui: Scoreboard Model - Roblox

Nope, the scripts should be unloaded everytime a player leaves, so there will be no memory issue.

1 Like

But if its reseting parts inside the script is that a issue, for example it clones a backup of the map and replaces it.

I can’t say for sure without looking at any code, but if implemented correctly, there should be no problems.

1 Like

Could you please take a skim at the timer script around line 37?

Oh sorry, I totally forgot that you had a model posted :joy:
I am on my phone right now, I will try my best to do something

1 Like

heres the code Im concerned about:
dirtModel = dirtModelBackup:clone()
dirtModel.Parent = game.Workspace

Since it’s not a local script is it doing it since for everyplayer there is? if so then is this a problem?

If it’s not being cleaned up, yes that is an issue. That could cause performance issues in games after the server has been up for some time and players join and leave.

1 Like

Do you have a solution to that?

Okay, I have the answer! As long as no variable is referring the instance anymore, it will be deleted, hence freeing up memory. So, set all the virables that might be storing the instance value to nil, and you’re optimized in terms of memory. Read more here.

Edit: in your code, you override the previous variable which also counts as an unload hence deleting the instance for good.

1 Like

So just dirtModel = nil instead of remove or destroy?

I would recommend :Destroy and not equal nil. if u wanna destroy

Yes, you can set it to nil, or even :Destroy() it