I want to make it so that when a player touches a door the door allows them to go through then closes by itself. So I wrote up this script and it won’t work. (Keep in mind i’m a noob and this is my first script I wrote all by myself)
local part = workspace.Part
local debounce = false
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not debounce then
Door.CanCollide = false
debounce = true
Door.Transperency = .5
wait(3)
Door.CanCollide = true
Door.Transparency = .5
debounce = false
end
end
end)
You spelled function wrong, part isn’t defined correctly (doing workspace instead of game.Workspace works to), and you need to check if there is actually a player touching the part instead of anything. Let me know if you have any other questions.