How to replicate client-side shell ejection and keep server and client shell ejection seperate?

I’m making shotgun animations and have reached the part where the shell ejects out the ejection port via body movers. I have this done client-side first so it’s smoother but when I try to replicate it to the server the client sees two shells eject. How do I keep the client and server shell ejection separate so that the client only sees the client-side shell ejection?

1 Like

Fire remote to server and then server fires remote to all clients but the caller of the remote to animate the shell ejection. I don’t see a need for the server to actually create a shell, you can just do it on everyone’s clients

-- client
function shoot()
    animateShellEjection(LocalPlayer)
    remote:FireServer()
end

-- server
remote.OnServerEvent:Connect(function(caller)
    for i, otherPlayer in pairs(Players:GetPlayers()) do
        if otherPlayer ~= caller then
            remote:FireClient(otherPlayer, caller)
        end
    end
end)

-- client
remote.OnClientEvent:Connect(function(otherPlayer)
    animateShellEjection(otherPlayer)
end)
1 Like