this is probably because of client-server latency
there's a little bit of delay between actions happening on the server and actions happening on the client, so when the client tells the server to fire the gun and make the beam, there's a delay, and then when the server creates the beam and tells the client "hey i made the beam", there's another delay
what people usually do to get around this is to create a "fake" beam on the original client, and then have the server do tell all the other clients to create a beam as well once the gun is fired, so that other clients see the beam but the original client gets instant feedback
while all of this is happening all of the damage calculations, raycasting, all that sort of stuff is still on the server, it's just "invisible" in a way
you could make a "fake" beam on the original client, then just make one on the server, but then you have to do a whole bunch of hacky stuff to destroy that beam on the original client and it's just generally Not Good so i prefer doing it on every client individually
local CreateBeamRemote = path.to.RemoteEvent
local FireGunRemote = path.to.AnotherRemoteEvent
local function CreateBeam(origin, endpoint)
end
local function FireGun()
local origin = whatever
local endpoint = wateva
CreateBeam(origin, endpoint)
FireGunRemote:FireServer(origin, endpoint, idkSomethingImportantProbablyGoesHere)
end
CreateBeamRemote.OnClientEvent:Connect(CreateBeam)
local Players = game:GetService("Players")
local CreateBeamRemote = path.to.RemoteEvent
local FireGunRemote = path.to.AnotherRemoteEvent
FireGunRemote.OnServerEvent:Connect(function(player, origin, endpoint, idkotherstuff)
for _, playerToSend in pairs(Players:GetPlayers()) do
if playerToSend ~= player then
CreateBeamRemote:FireClient(playerToSend, origin, endpoint)
end
end
end)
of course you don't need to use this exact code, it's just a suggestion...also if you used this exact code it would probably be very broken
1 comment
Thanks! This really cleared things up.