Effects handler style?

My code currently sends effects to client through a RemoteEvent that contains a key, and then any additional data.

This key simply tells the client what effects to fire.

This is simply a tiny excerpt of my server effects. I was wondering if there was any way to make it look cleaner.

local function effects(Character)
	Remotes.Effect:FireAllClients("RemoveLimb", Character, "LeftHand")
	Remotes.Effect:FireAllClients("Plasma", Character)
	local origin = Character.HumanoidRootPart.Position + Vector3.new(0, 250, 0)
	local point = origin - Vector3.new(0, 255, 0)
	Remotes.Effect:FireAllClients("BranchLightning", origin, point)
	Remotes.Effect:FireAllClients("Sound", Character.HumanoidRootPart.CFrame, "rbxassetid://4683291840")
	Remotes.Effect:FireAllClients("Explode", Character.HumanoidRootPart.Position)
1 Like

Yes. Remove all those short interval yields using the wait function. Also, you should consider a more customizable modular approach, unless you’re still just testing but the again I would argue even for that you should be writing somewhat decent code. Anyway, that’s beside the point, just fix the waits and such.

1 Like

All of those effects are modules, fired from the server in order. The game tells the clients what effects to make with delay. It also feels a bit needless to make modules for effect event to fire.

The short yields have to be used somewhere since most of the effects overlap.