Roblox Scripting Tutorial: Whitelisted (Owner Only) Door using FilteringEnabled
I know the title can be a bit confusing, so let me explain. In this tutorial, we use the way that manipulating parts in Workspace from a client makes them appear differently to everyone to make a door that only whitelisted players can pass through, even if other players follow directly behind them.
Server Door Script:
rs = game:GetService("ReplicatedStorage")
event = rs.OpenCloseDoor
allowedPlayers = {"Rrrrry123", "Player1"} - Replace this array with a string value if you prefer.
debounce = false
script.Parent.Touched:connect(function(hit)
if not debounce then
debounce = true
local char = hit.Parent
if char then
if char:findFirstChild("Humanoid") then
local found = false
for index, item in ipairs(allowedPlayers) do
if char.Name == item then
found = true
end
end
if found then
event:FireClient(game.Players:FindFirstChild(char.Name), script.Parent)
end
end
end
wait(1)
debounce = false
end
end)
Client Script:
rs = game:GetService("ReplicatedStorage")
event = rs.OpenCloseDoor
event.OnClientEvent:connect(function(door)
door.CanCollide = false
--Delete the following --s if you want the door to close after the whitelisted player passes through.
--It doesn't really matter, as no one else will be able to get through anyway.
--wait(3)
--door.CanCollide = true
end)
Be sure to follow me on Twitter after subscribing!
https://twitter.com/Rrrrry123
Also, follow me on Twitch for some live streams!
http://www.twitch.tv/Rrrrry123
Other Videos By RyGuyGaming
Other Statistics
Roblox Statistics For RyGuyGaming
At present, RyGuyGaming has 459,946 views spread across 106 videos for Roblox, and roughly a days worth of Roblox videos were uploaded to his channel. This makes up 17.76% of the content that RyGuyGaming has uploaded to YouTube.