how do you make 2 different functions, one for if you dont have a keycard and one if you do the keycard name is handle: workspace.keycard.handle
how do i do if u dont have a key card a function happens and if you do the door opens(dont add the actual script for the door just how to do this^^)
would i do
if hit.Parent:FindFirstChild("Handle")=true then --my script
if hit.Parent:FindFirstChild("Handle")=false then --my script
the key card sensor is called Door and the keycard is called Handle
I'm thinking you are trying to make a Keycard Door. Put script in door and make a tool called "Keycard".
local time = 3 -- time the player has before door closes script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Keycard") then -- player has to be holding a tool called "Keycard" -- the handle for any tool is called "Handle" -- and so it is better if you get the tool name -- make sure it is called keycard script.Parent.CanCollide = false script.Parent.Transparency = 0.5 -- changes properties so play can go through wait(time) -- waits value of time script.Parent.CanCollide = true script.Parent.Transparency = 0 elseif not hit.Parent:FindFirstChild("Keycard") and hit.Parent:FindFirstChild("Humanoid") then hit.Parent:BreakJoints() end end)