How to optimized my game abilities?

Hello im amaro, and i want to performance on my game, i learn that having too many connections make the game laggy by over time, that what is happening right now with my game, so to use a move in a ability on my game uses a local script, firing a remote events from a module script that have a metatable with functions that have the moves, and how i say before having too many connections make lag on the server, so i wonder if there any way to make the remote events optimize? Or instead of using a local script for each ability and using remote event, use a script or module script for each ability, replacing the local script method

You could set connections to a variable

local Connection
Connection = game:GetService("RunService").Heartbeat:Connect(function()
	--Input stuff here
end)

Connection:Disconnect()

Either that or you could use Maid to manage memory