Currently, one of the experiences I’m part of is experiencing some not-so-great performance. The server FPS/performance starts dropping dramatically very quickly, even without much user interaction.
I have read many things on how this could be fixed, but I just do not understand any of it.
I also looked at gcinfo(), but I don’t know what it means or does.
After about 20 minutes, the server FPS has dropped dramatically from 60 to anywhere between 15 and 45 FPS
(screenshot from Adonis “!serverlag” command)
Have you got any nested connections? So like a property changes and you start a render stepped or while loop? Disconnecting events can become a super big issue as roblox’s garbage collector while superb takes some time to kick in
Object:GetPropertyChangedSignal("Hey"):Connect(function()
RunService.RenderStepped:Connect(function()
-- Unless you disconnect the connection this will always run
end)
end)
I’ll do that but first we will work to look through the scripts to find one… it was back from the ‘time of free models’
Thanks for suggestion and I’ll get back to you when we find it
You can create a variable outside of the scope you defined the second signal from.
local Signal = nil
Object:GetPropertyChangedSignal("Hey"):Connect(function()
if Signal then
Signal:Disconnect();
Signal = nil
end
Signal = RunService.RenderStepped:Connect(function()
end)
end)
Actually, I glanced over it initially. This is more proper.
Building off of that, signals will run indefinitely unless the script that connected them is destroyed (terminating the thread), or the signal itself is disconnected.
It’s very important to keep a reference somewhere to a signal you connect at all times so you can clean it up manually when you need to.
Roblox’s garbage collection system does not clean up connected signals.
while true do
for i = 1,#imgs do
script.Parent.Image = "http://www.roblox.com/asset/?ID="..imgs[i]
wait(0.03)
end
end
And I’ve just deleted it as it isn’t needed (although I doubt it did much harm)
We’ve gone through the 900 no name scripts in workspace and just deleted and disabled some
Ill check micro profiler after studio starts responding again
since I probably am trying to close about 200 scrips
It looks like one of those animated gif loops.
You can use a module-script (or a collectionService loop if it’s just for specifically tagged Instances) for repeated code instead so you don’t have to mass-replace 200+ scripts.
It depends on what you’re connected to, really.
The Connect method always returns a connection so you can create a variable that holds onto the signal and you can disconnect it later.
Calling the :Destroy() method on an Instance will disconnect all the connected signals to it, so you don’t have to reference the signal if you’re going to destroy that instance later anyways.
You have a script (or two) connected to the “Heartbeat” signal under RunService.
They’re taking up a lengthy amount of time (hence the long bar with the “Heartbeat” under the MicroProfiler.)
There’s a very useful guide on actually utilizing it so you can easily discern issues regarding your game’s performance.
Async is short for Asynchronous, which I assume means you have a thread running some code somewhere so the rest of the script continues running parallel to the other code.