I suggest having one remote event for each player that would handle client > to server requests, and a single remote event for all players that would handle server > client requests as many players firing the same remote event can throttle your code.
Throttle your code? What does that mean
There was a post about a game that sent all its traffic through one event, the game performed very poorly
I see.
Then I guess vsnryâs method makes sense
so thanks for clarifying
Using some calculus, you can actually make the clients and server be roughly in sync.
You need to adjust the projectile speed based on the latency of the player, though, so itâs a lot of math.
Working example:https://www.roblox.com/games/498817078/Armoured-Assault-Tank-Warfare-ALPHA-TESTING
I HEAVILY suggest watching this gdc talk about networking Halo
https://www.gdcvault.com/play/1014345/I-Shot-You-First-Networking
Donât even consider working on this problem till you have
You can sync the server and client completely if you were to send timestamp of when the bullet was fired.
Example code:
*wrote this in devforums themselves, sorry for the formatting and if there are errors, itâs just a representation
of how I tackled this issue.
-- Client
remoteEvent:FireServer(tick())
--Server
remoteEvent.OnServerEvent:connect(function(time)
Projectile.new(time)
end
-- Projectile
local Projectile = {}
Projectile.__index = Projectile
Projectile.new = function(time)
local self = setmetatable({
startTime = time;
start = A, --> Should be passed as well in remote call, but lets say
finish = B, -- we're firing from A to B.
velocity = 80,
currentPos = A
}, Projectile)
coroutine.spawn(function()
while true do
local t = wait()
self.currentPos = self.currentPos + CFrame.new(self.currentPos, self.finish).lookVector * (t * self.velocity)
end
end)
return self
end
return Projectile
Hm I was under the impression that time() wasnât guaranteed to be synced between server and client?
Isnât os.time() seconds since the unix epoc? that ought to work
It isnât millisecond resolution, which is what you would need to do something like projectile syncing using only timestamps
AFAIK, the only way to make this work is to use latency with tick(), since tick() isnât guaranteed to be synced across server and client. Correct me if I am wrong, though.
My team had a similar problem attempting to nullify projectile delayâs until we found an API created by a prominent member of the Roblox Developer Forum known as Xan_TheDragon. He created a useful API known as âFastCastâ; which in practice eliminates projectile based gun physics lag on the serverâs end. The whole thing operates off a modulescript API libary which allows for complete customisation from the ground-up.
You can grab it here:
Hope this is helpful.
Hey guys, back again!
Attempted to make the Spellâs parent be the Client of the individual players etc. But having no luck, the only argument that seems to pass is setting the actual LocalPlayer [The Caster themself] as the Parent of the spells.
How would I do this?
for it to only exist on the client you need to create it from within a local script
Iâm back again! Ran into more issues that have appeared for some reason?
When creating the new spell and setting it into the localPlayers Character, itâs doing so across the WHOLE server - So because of this, when Iâm trying to insert a single spell itâs creating one for every single Player, how to avoid?
Could we please see your code on how the client deals with events fired about spells, and how you fire these events?
From my first assumptions, I believe when someone is casting a spell, you are probably using :FireAllClients() to indicate to all clients this spell has been cast?
I think what you need to do inside the OnClientEvent is to check the player argument, which can be sent by the server, and parent it to the actual player who sent it, rather than always the LocalPlayer.
This is all based off assumptions as I havenât seen any code, but this is one possible reason why itâs happening