However in Play mode it only works sometimes while the player is inside the elevator. Upon the player exiting the elevator it goes back down. (This is not scripted)
The script is very simple. It simply sets the target position of the prismatic constraint.
How do I make it work even without a player inside the elevator? Why is it doing this?
Do you ever set the network owner of the root part of the elevator to the server? You may be experiencing discrepancies when owners change, causing this behaviour. It’s worth attempting.
Though, it may have had something to do with the fact I was calling the function to move the elevator from the client. Just to be safe, I’ve kept the network ownership changing.
If the client is the one setting the constraint’s properties, then network ownership changing would definitely present some kind of issue. In this case it would be best to either shift the elevator fully client-sided or put the server in charge of moving the elevator around. The former is preferred for the smoothest experiences.
The server is completely responsible for moving the elevator, I was just running the function from the command bar which I think will run code from whatever the current view is (client / server) and I was running it on the client