Hey!
Depending on what the answer is to question 1, I may need to rewrite my code on how the doors open.
Question 1:
What would be more optimized? When a player a pushes a button a door will slide open/close, would it be better to make it so once the button is pushed it uses FireServer() to open/close the door or would it be better to make it so once the button is pressed, it uses FireServer() to fire an event that will FireAllClients() to open/close the door for all clients? By far from I’ve read it is better to go for option 2 which is the FireAllClients method, but I’m seeing what people will comment here.
Currently, I am using method 1 which is the FireServer method but, if I am correct that using method 2 is more optimized then I plan to rewrite my code so it uses method 2. If this is a case then please go on and read question 2!
Question 2: How could I rewrite my code to use method 2? It needs to be compatible with streaming enabled. My thoughts are, once the doors is finished playing the lerping animation that opens/closes the doors, that the CFrame
of the door will set the CFrame
of the end CFrame
on the server to ensure the door is opened/closed, just incase the door gets streamed in to any clients after the animation was played before the door was streamed in. One problem I’ve got about this is, if the door gets streamed in while the door is lerping, I don’t want the door to instantly go to the finished CFrame
at the end of lerping animation and I don’t want the door to be 20% opened for the player that just had the door streamed in and the door to be 60% opened for the player that had the door streamed in since the animation started.
An attritional question to this, what would my options be if the door streamed out while the animation is playing?
Question 3: Would it be worth to just change the Doors ModelStreamingMode
to Persistent? That way the doors will animate no matter how close or far the player is from the door (Question: Does setting a Models ModelStreamingMode to Persistent mean that the model load in straight away and never stream out and act as if StreamingEnabled
is disabled?)
I am aiming for my doors to open and close which ever way is most optimized, so if you have any other ways or suggestions then let me know!
If you would like to make an example file then that would be greatly appreciated but an explanation works just as well!
I’m sorry that I made this post so long! It took my over 30 minutes to write this, but please read all of this post as there may be some hidden important parts that you may need to read!
Thanks, any help appreciated!