Hello everyone. I’m having trouble understanding how local scripts work.
I assigned a script to the part and selected the client in the script properties.
When the player approaches the part, the script applies an applyImpulse to the player and throws it aside.
I expected that this would be visible only to the local player, however, during testing I saw that the repulsion effect is visible not only to the local player but also to all players and is reproduced on the server. The script works as it should, but I’m worried that I don’t understand why the effect applied to the player by the local script is visible to everyone?
I’ve read this before, but how does it apply to my case?
Whenever a player gets close to/touches a part, Roblox automatically assigns them as the “network owner” of it, which means they handle all the physics calculations for that part. So whenever you call ApplyImpulse on the client and they’re the network owner, everyone else will be able to see it
It turns out that any physical impact is visible to all players. And if, for example, I teleport a player with a local script through a CFrame?
Teleporting the player on the client works because they have network ownership over themselves
In general, all simulated physics is replicated. If you CFrame a player this change will replicate as the player is a physically active assembly so the server will update the position to all clients to keep things in sync. If you were to CFrame an anchored part it wouldn’t as these are not physically simulated.
Thank you for your answers. I think I figured it out.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.