I have a local script that creates a moving local part in starter gui, however, the moving part for some reason is somehow affected by other players but only in a specific situation. I also tried putting the script into starter player and character scripts but that didn’t work either.
This is my code.
The situation where the part is affected by other players is when the part is moving up and down and 2 players are bot on it, even though they are both local parts the players both affect each other’s parts.
Well basically when 2 players are bot on a moving part at the same area when the player collides with the other player’s local moving part, it starts to jitter a bit eventually leading to the player falling off.
Don’t know if it’s intentional but in the player removing event you just destroy the part, meaning whenever any player leaves the game (not just the local player) all parts will be destroyed
It’s more of if anyone leaves the parts will be destroyed.
@ZeInventor if you want it to remove it when the player leaves, there’s no need since everything on the client will be deleted anyway, so you can just remove that “PlayerRemoving” entirely.
One of the players falls off but neither of them see the other players part, they only see their own, also I don’t think this issue has to do with the situation, I think it has to do with the making of the part itself, of course I could be wrong.
Also, the checkboxes are very important here. They are what causes parts to ignore other parts and pass through them or actually collide with them. A check means the parts in both collision groups will collide with each other.
I had the server place all of a player’s characters into the “Players” collision group when they spawn using the CharacterAdded event. I did this by looping through their character’s model and putting any BasePart into the Collision Group with PhysicsService:SetPartCollisionGroup([BASEPART_HERE], “Player”)
Then the client would place all of their character’s parts into the “ClientPlayer” collision group. I did this by looping through their character’s model and putting any BasePart into the Collision Group with PhysicsService:SetPartCollisionGroup([BASEPART_HERE], “ClientPlayer”)
Also you need to place any client-sided part into the “ClientParts” collision group.
Extra Partially Related Notes:
All BodyMovers have newer replacements that Roblox recommends you use instead.
Also, you do not have to destroy client-sided parts when the player leaves. That’s just silly because the entire client basically gets deleted when they leave because that person’s computer is no longer running your Roblox game.
Do not touch CanCollide if that is what you mean by “disabling collisions for the parts”. This is Collision Groups, they are different from outright disabling collisions. For clarification, I am not telling you to never disable CanCollide, it’s just not needed for this situation.
But, yes, if you do not want other players to interfere with a client’s client-created parts, then you have to make it so the other players’ characters pass through those parts, and Collision Groups are a great way to do that.