I’m making client-sided parts for my game and the collisions with them are not working as intended. If there is two players and an unanchored part has the client object value, then each player should only be able to interact with the box on their client. At least that’s what I thought should happen, so I do not understand why a player can move one on another client. They cannot stand on it or see it but somehow if they manage to move where it happens to be, they end up pushing it. This code in in a local script in StarterPlayerScripts.
Roblox is pretty inconsistent with replication so parts that aren’t on your client but on someone else’s can still be moved by you.
The way to do it properly is to create the parts on the server, and set collision groups so that only you can collide with your ball. Then, on the client, do visual modifications to the other player’s ball like changing transparency.
Yes, shouldn’t be too difficult though. What I would recommend is naming each ball their user id (or adding an attribute that includes their userid), and then when they leave, use :FindFirstChild to check if it exists, if so, destroy it.
Since my only problem seems to be the box colliding with players not on the client would there be a way to make the box have a collision group that can only colide with their player? One problem is I aready have a script for disabling players collisions with each other and I’m not sure if it would break that.
That won’t affect you being able to collide with your box.
What I would do is create a new collision group for every individual player, and every individual ball, then set up the parts in each collision group. After the game ends or you want to get rid of the ball, just destroy both the ball’s collision group, and it’s respective player collision group.
Here’s a pretty hacky method:
Set the box’s CanCollide to true on the server and then set the box’s CanCollide to false for every client except the one you want to interact with the box.
This is not secure, however, so use collision groups as @Katrist suggested if security matters.