Inefficient Client-Server Communication? My game is solely client-side

So I’m trying to make a game about running which involves making almost everything about running client-side.

I want every client to see what a player does and the VFX so I proposed this method for every input a player would have in my game.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Remotes = ReplicatedStorage.Remotes

local Actions = {}

Actions.Init = function()
	Remotes.ToServer.OnServerEvent:Connect(function(player,signal)
		if signal == "Enable" then
			Remotes.ToClient:FireAllClients("Enable")
		elseif signal == "Disable" then
			Remotes.ToClient:FireAllClients("Disable")
		elseif signal == "Increase" then
			Remotes.ToClient:FireAllClients("Increase")
		elseif signal == "Decrease" then
			Remotes.ToClient:FireAllClients("Decrease")
		end
	end)
end

return Actions

I don’t think this is the write way to code at all. I saw Suphi Kaner’s tutorial on Client Replication but it taught me nothing I didn’t already now.

I basically fire to the server whenever a player presses a button and it fires to the server for things just to be sent back.

I think this will make my game more laggy and its not very nice to look at.

Is this right?

2 Likes

Can tell a bit more about these inputs, and the kinds of effects that would have to be replicated on their activation? What aspects of your game are client-side; and why did you opt to land on this approach over standard replication?

1 Like

The charging ability(for getting stamina) requires for the player to press/hold F and not be running(an attribute).

My game is client-side because its entirely movement and the only things that arent client side are the hitboxes, zombie spawners, and this module.

Since you are firing exactly what the signal is, why not just fire the signal?

Remotes.ToClient:FireAllClients(signal)
2 Likes