manually updating the rotation frequently like that can cause stuttering issues – when someone clicks on it, you should just give it angular velocity. we interpolate smoothly in the physics engine this way. then, when someone clicks on it again, give it angular velocity the other way. you can check in your update loop to see if the door rotation is either ‘fully open’ or ‘fully closed’ and then zero out its angular velocity.
if another user comes and clicks it while its opening, check for the current angular velocity and then swap if you want the door to start shutting, and vice versa
i was looking here to see what your userData problem was, but you’re not using userData. that doorIsOpen variable is local to this entity script on each users machine, so yeah you’ll run into problems trying to keep state there (the toggle) if you send your updated script i can try to help.
but you shouldn’t really need userData with a pattern like this – your ‘shared state’ is knowledge about the angular velocity – that’s already kept in sync by the entity server. so instead of making up a variable for ‘open’ and ‘closed’, just check whether the angular velocity is in the ‘open’ or ‘closed’ direction and whether its current rotation is ‘open’ or ‘closed’