Possible to make part move for only one player using localScripts?

read until end

The title explains it all. I am wandering if it is possible to make a tween for a door only apply to one player using localscripts. Also, will other players be able to walk through the doors even though they don’t see the tween or do they have to see the tween to be able to walk through?

If you need clarification on something do not hesitate to ask.

Any help is appreciated.

Thanks!

1 Like

Yes, if you move a part with a local script, it will only happen for that player. Other players can only walk through doors they see are open. However, the way that local movement interacts with sever movement is very strange, it will toggle between two states based on how close the local player is.

2 Likes

What do you mean by this? Does it close without you wanting it to or something?

If the local-only door swings into a part owned by the server, the player will either see that part pushed out of the way (it actually isnt, on the server), or will see it stay still as the door passes through it. It will toggle between the two states semi-randomly until it is eventually restored to a consistent position by being pushed by an object on the server.

You can try this by putting two pushable blocks in your game, one “real” just placed normally in studio, and one spawned by a local script, and pushing them into eachother.

Yes, it is possible, i didn’t really understand about “will other players be able to walk through the doors even though they don’t see the tween”, i think you mean if they will be able to walk through the door if the tween is not ended, if you want that just make cancollide false for the door, if you dont want to make it go through, just set cancollide to true. It wont affect the server as it is in client side and there is no server connection whatsoever. You can also use collision groups to make it so door will only collide with player.

I’d test it with a friend, or an NPC placed on the moving side of the door to see if they’d be pushed.

I’ve got rocks in a construction site game I which I tried to make more optimized by having each players rocks only in their server. If another player uses equipment to move their rocks it will also move the rocks for the other players since they are reacting to the vehicle on the server too.

I’d suggest putting doors on each client that are only scripted to be opened for that server. This should (I think) keep others from being able to walk through the doors on their servers.