I wanted to know if it was possible to make only a certain player nocollide with an object. For example, here's a scenario (the names are just for examples):
One player decided to join a server. Another one decided to join him. The first player will be named builderman and the second player will be called shedletsky. Builderman walks up to a door and he's able to access it, and enter it, however shedletsky cannot. Builderman cannot even possibly open the door for shedletsky because only builderman can go through it. This is due to builderman reaching a specific requirement and is nocollided with the door, but since shedletsky isn't, the door stays collidable with him.
Ending the scenario, here's what I got down so far. The "requirement" stated is being in a certain group. However, I find that while difficult, it is not impossible to keep the door open for another player (who is supposed to be restricted from entering). How would I be able to make it so that only a certain player meeting that one requirement is only nocollided with that one object, while the other one still cannot enter despite trying to hold it open (or keep it open).
script.Parent.Touched:connect(function(hit)
if not hit.Parent:findFirstChild("Humanoid") then
return end
local plr = hit.Parent
if plr:IsInGroup(GroupA) then
script.Parent.CanCollide = false
wait(0.3) -- My friend and I tested if it was possible to go through a door with only one of us having the requirement and it took a while, but wasn't impossible.
script.Parent.CanCollide = true
elseif plr:IsInGroup(GroupB) then
script.Parent.CanCollide = false
wait(0.3)
script.Parent.CanCollide = true
end
end)

5 comments
Hmm. One way I can think of is using localparts(via the camera or Filtering). Render the parts on the client instead of the server.
You could just use a teleporter or make the wait a wait() and and if the player is not granted access, kill them or use Loadcharacter on them ... so on.
With filtering enabled you can do this. No collide the part from a localscript with filtering enabled on and that will only make it nocollided for that player
Another tip: Instead of two separate conditions, just connect them, since you do the same thing either way. 'if plr:IsInGroup(GroupA) or plr:IsInGroup(GroupB) then'
How would I do this in a localscript?