What I'm trying to do is to make a specific piece (part) phase so a specific userID (My userID) may only be able to go through it, this is the code (I put it in as a LocalScript) -
local player = game.Players.LocalPlayer local id = 17427977 if player.UserId == 17427977 then part = script.Parent part.Touched:connect(function(hit) Part.CanCollide = false Part.Transparency = .5 wait(1) Part.CanCollide = true Part.Transparency = 0 end end end
local player = game.Players.LocalPlayer local id = 17427977 part.Touched:connect(function(hit) part = script.Parent if player.UserId == 17427977 then Part.CanCollide = false Part.Transparency = .5 wait(1) Part.CanCollide = true Part.Transparency = 0 end end end
try this, you might have to fiddle with some of the ends though since it got formatted a little bit weird
In StarterCharacterScripts
add a LocalScript
which has this:
local Players = game:GetService("Players") local player = Players.LocalPlayer local owner = 1 -- id local door = workspace:FindFirstChild("Door") -- path to your door if player.UserId == owner then door.CanCollide = false end