Specific player only door

I’m Making a Simple Player only door but it won’t open for me.

Code:

script.Parent.Touched:Connect(function(hit)
	
	local Player = hit.Parent
	print(Player)
	
	if Player == ("RinkyD1nk") then
		script.Parent.CanCollide = false
	end	
	
end)
1 Like

Yes It would also work for tables

1 Like

Just simply make remote function and do OpenDoor:FireClient(plr)

And in Client Side

Turn CanCollide to true

the code would look something like that

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteName")

-- To Send Message To Specific Player's Client To Open Door For Him
RemoteEvent:FireClient(plr)

And the Local Script would look like that and it would be placed inside of the StarterPlayerScripts or StarterGui

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteName")

RemoteEvent.OnClientEvent:Connect(function()
Door.CanCollide = false
end) --Check if its actually called onClientEvent idk maybe its something similar

Would that also work for Tables?

1 Like

Yes it would also work with tables

1 Like

Tables aren’t working for me, not sure what’s wrong

Code:

Janitors = {"RinkyD1nk","Jammalthekid","IIllikehampig", "AquaticCrow", "jjpeterson05", "ohnooooooohno", "ilovecookie921"}
TicketSeller = {"RinkyD1nk", "Jammalthekid", "IIllikehampig", "ohnooooooohno"}

script.Parent.Touched:Connect(function(hit)
	
	local Player = hit.Parent
	print(Player)
	
	
	if Player.Name == Janitors then
		script.Parent.CanCollide = false	
	end	
	
end)

Please respect the Janitors and TicketSellers Privacy.

Because you are checking of the Player.Name == Janitor which is checking of the player’s name equal to the list it self

if you look into my damn response before that you would know its better but no you choosed to go with the easiest but the worst

apologies, sorry for that, i will look into more responses from now on

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.