My function for some reason just loops, like it prints Sound and Opening a bunch of times, so the whole function loops, and i only want the for loops to loop. What is the issue?
function Door(door,str,num)
local function UpSide(str,num,num2)
if str == "Side" then
print("Side")
for i=1,num do
task.wait(0.01)
end
else
print("Up")
for i=1,num do
task.wait(0.01)
door.Door.Position += Vector3.new(0,num2,0)
end
end
end
local IsOpen = door.Door:GetAttribute("Open")
door.Door.Click:Play()
task.wait(0.1)
print("Sound")
if IsOpen == true then
print("Opening")
door.Door.Open:Play()
ChangeDoorPrompts(door,false)
Door(door,str,num,-0.1)
door.Door:SetAttribute("Open",false)
ChangeDoorActionText(door,"Open")
ChangeDoorPrompts(door,true)
else
print("Closing")
door.Door.Open:Play()
ChangeDoorPrompts(door,false)
Door(door,str,num,0.1)
door.Door:SetAttribute("Open",true)
ChangeDoorActionText(door,"Close")
ChangeDoorPrompts(door,true)
end
end```