button is named
button
wall thats meant to open is
buttonpush
the script is placed inside the button
heres my code
local part = Instance.new('Part')
part.Anchored = true
part.Parent = workspace
part.Touched:connect(function(hit)
local hum = part.Touched:Connect("FindFirstChild")
if hum then
game.Workspace.buttonpush.CanCollide = false
wait(3)
game.Workspace.buttonpush.CanCollide = true
end
end)
button = workspace.button
button.Touched:connect(function(hit)
local hum = part.Touched:Connect("FindFirstChild")
if hum then
game.Workspace.buttonpush.CanCollide = false
wait(3)
game.Workspace.buttonpush.CanCollide = true
end
end)
EDIT: Unless I misunderstood, and the button you want is not a Part that should be touched. Do you want it to be a GUI?
Clearly not,
You can fix this by using a click function on the part unless u want it when u touch the door then ur just nearly there but i not used them for years.
its a part but i dont see in this code where the part buttonpush (the wall)
that your meant to have 3 seconds to walk through until it becomes solid again comes in to this code
edit: nevermind im just silly
The only problem is that you are trying to connect a string of “FindFirstChild” to a touched connection inside of another touched connection. You should be trying to find the Humanoid through a FindFirstChild function of the hit’s parent.
local part = Instance.new('Part')
part.Anchored = true
part.Parent = workspace
part.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
game.Workspace.buttonpush.CanCollide = false
wait(3)
game.Workspace.buttonpush.CanCollide = true
end
end)