SetVehicleDoorBroken Server side doesnt sync with closest players

i was trying to sync the vehicle doors but in this case it doesn’t matter if the door is deleted on the server or the client side, always the other person will see the door model on the ground.
The steps to reproduce:
1)- Create a vehicle server side (any vehicle) with CreateVehicleServerSetter.
2)- Create a Command and send an event to the server and delete the door (i even did the SetVehicleDoorBroken on client to test and same result).
3)- For the person who trigger the command the door disappears, but the rest of the people the door remains in the ground.

First Video:

https://cdn.discordapp.com/attachments/1076002989099192350/1076002991691284480/Desktop_17-2-2023_1-23-11_-_Trim.mp4

Second Video:

Doors

PD: On the first video i already delete the door server side when the vehicle spawn.
On the second video i remove a door with a command then i take the second character and go really far from the vehicle, when i come back the doors are deleted from the ground.

PD2: If the vehicle is created client side the problem doesn’t not exist.

I found a “solution” to this problem, if i use State bags the problem doesnt get replicated

Hey, could you share an example on how you achieved it? Thanks in advance!

Yes, Create the vehicle server side, then apply the state bag with the info and on the client just “listen” to the bag and apply all the damage on the client.

SERVER

local vehicle = CreateVehicleServerSetter("adder", "automobile",  coords.position.x, coords.position.y, coords.position.z, coords.position.w)
while not DoesEntityExist(vehicle) do
      Wait(0)
end

local network = NetworkGetNetworkIdFromEntity(vehicle)
                   Wait(200)
local netid = NetworkGetEntityFromNetworkId(network)
local state = Entity(vehicle.netid).state:set("doors",{--[[ Damage Info]]},true)

CLIENT

AddStateBagChangeHandler('doors', nil, function(bagName, key, value, _unused, replicated)
    local entity = GetEntityFromStateBagName(bagName)
    if entity == 0 then return end
    --Check and apply the damage here
    end)
end)
1 Like

Thanks a lot for your response, I look into it!