Open combine door

Im trying to open a combine door when im pressing E but its not working
ive made this but when i press E on it nothing happends. And there are no errors.

[lua] function opendoor(ply,ent,autoclose,closetime)
if not ent:IsValid() then return end
for k,v in pairs(ents.FindByClass(“prop_dynamic”)) do
ent:Fire(“setanimation”,“open”,“0”)
if autoclose == 1 then ent:Fire(“setanimation”,“close”,closetime) end
end
end
function closedoor(ply,ent)
if not ent:IsValid() then return end
for k,v in pairs(ents.FindByClass(“prop_dynamic”)) do
ent:Fire(“setanimation”,“close”,“0”)
end
end[/lua]

Isn’t it func_door?

try making setanimation to SetAnimation and if the animation close is really Close use that also/

Please be a little more specific. Thank you :slight_smile:

Why are you looping through all prop_dynamics and then ignoring all of the results?

What that code does is that when run, the functions will play the animation as many times as the number of prop_dynamics on the map. And it’s not even your problem here.

How should i FindByClass if i didnt do that?

Your saying something there i will try it out.

About the setanimation it doesn’t make any different its the same. And mine is close

EDIT: func_door doesn’t work it has to be prop_dynamic else it doesn’t spawn.

Can we have some information on how your using this?

Do you mean in the gamemode ore do you mean in the door.lua im using the stool high6 made im trying to make so when you press E on a prop_dynamic it opens:

I don’t think combine doors like to be “used on”, i think something to do in the base code that doesn’t allow you to press use on combine doors as such. The only way i could think to get around it would be to find when player presses key and check the distance using a traceline to find the entity.