Not entirely sure if this topic belonged here, so please correct me and I’ll move it asap.
So I’m creating a fighting game which involves a lot of mechanics and I worry about the “bridge” between the client and the server. Almost all of my game interactions and mechanics are handled by scripts in ServerScriptService with client inputs handled in a localscript via UserInputService, and sent through RemoteEvents. My main issue is that it feels choppy (especially the body velocity demonstrated in the video), and I worry that it will affect gameplay and performance. So is there any way or method to make it “less laggy” without sending too much information from the client to the server? (I’m also worried about exploiters)
Video Link
As you watch the video, you’ll notice visible client-server lag, and especially the body velocity. This is what I’m concerned about.
Script Examples
--// LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local RemoteEvent = ReplicatedStorage.WarriorEvent
UIS.InputBegan:Connect(function(Input,gameProcessedEvent)
if gameProcessedEvent then return end
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
RemoteEvent:FireServer("Attack")
elseif Input.KeyCode == Enum.KeyCode.Q then
RemoteEvent:FireServer("Q")
elseif Input.KeyCode == Enum.KeyCode.E then
RemoteEvent:FireServer("E")
elseif Input.KeyCode == Enum.KeyCode.R then
RemoteEvent:FireServer("R")
end
end)
--// Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.WarriorEvent
local RotatedRegion3 = require(ReplicatedStorage.RotatedRegion3)
RemoteEvent.OnServerEvent:Connect(function(Player,Input)
if Input == "Attack"then
-- Code for [Attack] input
end
if Input == "Q" then
-- Code for [Q] input
end
if Input == "E" then
-- Code for [E] input
end
if Input == "R" then
-- Code for [R] input
end
end)
I think it’s also worth mentioning that I use EgoMoose’s Rotated Region 3 Module to do most of the game interactions.