Game performance and ping are terrible


I’m unsure how to see what exactly is causing this terrible performance. Microprofiler remains normal and memory is only at 600mb. Ping however is incredibly bad, server side errors for no apparent reason on lines that should not be erroring. With memory low too, I assume that means I’m clear of any memory leaks
Unsure why it’s saying allowed execution time is erroring on a return line? To my knowledge, should only occur on a loop without a wait, which there isn’t any loop related to these

function Tycoon:PublishTopic(topicName, ...)
	self.BindableEvent:Fire(topicName, ...)
end -- 281

function Tycoon:SubscribeTopic(topicName, callback)
	local Connection = self.BindableEvent.Event:Connect(function(name, ...)
		if name ~= topicName then
			return -- 286??
	return Connection

Button component code chunk

for i = 1, AddingDragons do
				local SlotNumber = #Data.Dragons + 1
				if SlotNumber > 180 then -- Reached max, force merge before adding more
					SlotNumber = #Data.Dragons + 1 -- Get updated SlotNumber
				Data.Dragons[SlotNumber] = 1 -- Add default dragon
				if SlotNumber % 9 == 0 then -- Need to add a new floor
				self.Tycoon:PublishTopic("SpawnDragon", 1, SlotNumber) -- 160

Ensure it’s just not your internet, Also Large physics operations and Bindable-Events/Remote Events constantly firing can cause lag.

To answer your question on the execution time on a return line, make sure when your creating a connection that has a callback that it is not infinitely recursing. Bindable events being spammed could also contribute both to the lag and runtime error.

I hope this helps, remember to sanity check your code with the debugger or some print()'s