Weird phyisics bug when Test Playing

I’m currently working on an earthquake simulation game and there’s a weird bug:

When I test Run the physics work perfectly but when I Test Play they dont.

Here videos of what happens:
Run:image

https://gyazo.com/7cc9574e90fc6c2e5a337cedb53fbdc8

Play:image

https://gyazo.com/eac65ab0a91db507db92a7b7ca2f298b

i’ve left Gyazo links because im not sure if the vids uploaed correctly

Hope this is the accurate category to ask this.

I’m not sure if this is the right category or not, maybe scripting support would be better? Either way, I’ll try to answer your question.

A difference between server view and client view usually means a difference in replication or Local Scripts. I would start by checking to see if you have any of those influencing what is going on.

1 Like

Im not sure either about the category because I dont think its a script issue
its something else.

I see, the server view looks alright but the client doesnt.

I have a hunch as to what’s going on, since I doubt you’re modifying the earthquake logic with a local script when it’s already been done on the server, and I also don’t think you’re using custom replication. It’s probably a network ownership issue. Try setting all the parts that are moving from the earthquake to have a network owner of nil, which will make their network owner the server and not the client. Otherwise, the client may take over the physics calculations for some or all of the earthquake parts, depending on the client’s proximity to those parts.

-- This sets network ownership to the server
part.PrimaryPart:SetNetworkOwner(nil)
1 Like

Including the constraints, or only the parts?

Just the parts I think. I think just the model’s primary part. You can turn on the ability to view Network Ownership in studio if you want to check your work as you go.

1 Like

image
I did this and it didnt work

By didn’t work, do you mean it gave you an error, or it didn’t fix the issue?

What if you looped through workspace’s descendants instead of just doing the primary parts of children models?

it didnt fix it. aaaaaaaaaaaaaaaaaaaa chars

If network ownership isn’t fixing it and you aren’t modifying the behavior on the client via local scripts, then try just playing it as a regular game not in studio. Sometimes studio lags, especially when it has to simulate both the client and server, so maybe it’s just lag? Other than that, I think I’m out of idea.

1 Like

I tested it outside of studio and even at Level 01 graphics. When I get close to things they start working normally but then when I get a little bit more away from them they glitch bag again.

Sounds like network ownership by the player might be helping you out in that case. Just curious, what’s your KB/S for your incoming data? Perhaps replication lag is taking a toll because of all of the moving objects?

1 Like

hmmm, I dont know if you are asking about internet speed or computer so I’ll give you these screenshots




image

Thanks for the screenshots. Your average is around 20 KB/S, which is very good. I don’t think it’s any sort of lag related to that. Unfortunately I’m at dead end right now trying to figure this out. Maybe try setting the network owner to the player instead of the server? Or make the earthquake happen locally in a local script instead of a server script?

1 Like

Yeah, but if its multiplayer??

Well, network ownership is usually auto-assigned to the closest player. If no player is close to an object, then the server has network ownership by default. But, you could write a script to manually search for the closest player and assign it.

In terms of local scripts, each player would simulate their own earthquake locally, and you could use a clock to sync up the earthquake on all the clients.

1 Like

I just ended up using body movers and forces.
Thanks for all the help!!! :+1:

1 Like