Door script helped needed

I need help, here is my script.
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Keycard”) then
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
wait(3)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end)

I need help “moving” the door when the user touches it.

2 Likes

TweenService is probably the best thing for making doors but i’m not great at using it so just read this

1 Like

Currently, your script only checks if the player is holding a Keycard.

You might want to check if they also have one in their inventory.

Change the if line to this:

local player = game.Players:FindFirstChild(hit.Parent.Name)
local KeycardInBackpack = player.Backpack:FindFirstChild("Keycard")
if hit.Parent:FindFirstChild("Keycard") or KeycardInBackpack then

There are lots of tutorials on youtube for door opening systems, so I recommend that you search before starting the topic