Edit : Hello, I have a problem with my script. I have placed a mesh part in the replicated Storage. When a player touches a part then the mesh part appears in the game locally. This part becomes unanchored, Cancollide true. The big problem is that : Yes the other players can’t see the mesh part, yes the other players can’t collide with the mesh part BUT strangely the other players can still move it by passing over it (while I remind him he doesn’t collide with it and doesn’t see it). What I would like is that the other players can’t move it. Does anyone know how I can fix this problem? I’ve seen some games using this mechanic so it must be possible
Sorry for my bad english i still learning english. Thank you
(Script below are not complet)
local plr = game.Players.LocalPlayer
local velocity = 5
local PlayerPart = game.ReplicatedStorage.basketball:Clone()
function onTouch6(hit)
if hit.Parent.Name == plr.Name then
game.Workspace.basketback.CanTouch = false
PlayerPart.Parent = game.Workspace
PlayerPart.CanCollide = true
PlayerPart.Anchored = false
end
end
game.Workspace.basketback.Touched:Connect(onTouch6)
There is nothing wrong, as you said, every client has their own part, so they can change the color, position and more. But others clients and server won’t see it.
So here’s what’s actually happening: the player is creating a part and touching it. Because the server trusts the player it will blindly accept that there is a part there and tell all the other players that the part exists. But because you’re only changing the cancollide and anchored properties on the client, it will only apply to the client, so nothing will change on the server.
Here’s how I would do this: create a part in a server script and make it invisible to all other players.
Server Script:
PlayerPart.Parent = game.Workspace
for i, v in pairs(game.Players:GetPlayers()) do
PlayerPart.Anchored = false
game.Workspace.basketback.CanTouch = false
if v.Name == plr.Name then
PlayerPart.Transparency = 0
PlayerPart.CanCollide = true
else
PlayerPart.Transparency = 1
PlayerPart.CanCollide = false
end
end
This is only to make the part invisible. Use it as an example and implement your own version in your script.
Uh, no. You’ve got a fundamental misunderstanding of how replication works on Roblox.
Here is the actual scenario:
The client is creating this clone of the part, locally.
Since it’s local, they have full “NetworkOwnership,” therefore, the client simulates all the physics for the part (locally).
When a different Player’s character interacts with the part, they tend to clip into it (you know, since they don’t actually simulate any collisions with it themselves), meaning the local client would simulate such, and it would move.
They may also be able to jump around on the part and consequently fling it sometimes.