No, theses function will never run until you call them here a little exemple.
function runningAFunction()
print("This function is running yay !")
end
runningAFunction()
you can also call a function like that
local aFunction = function()
print("Another function is running :D !")
end
aFunction()
you can put some Settings like that
function sum(a, b)
return a + b
end
print(sum(5, 5))
with return you can return more than one thing like:
function sum(a, b)
return a + b, "the second object"
end
local theSum, theString = sum(5, 5)
now if you you print like this:
print(theSum, theString)
and now the final result will look like this
function sum(a, b)
return a + b, "the second object"
end
local theSum, theString = sum(5, 5)
print(theSum, theString)
Now your code here:
local door = script.Parent
local oppened = false
local debounce = false
function open()
oppened = true
door.CanCollide = false
for transparency = 0, 1, .1 do
door.Transparency = transparency
wait(.1)
end
end
function close()
oppened = false
for transparency = 1, 0, -.1 do
door.Transparency = transparency
wait(.1)
end
door.CanCollide = true
end
door.Touched:connect(function()
if debounce then return end
debounce = true
if not oppened then
open()
else
close()
end
wait(1)
debounce = false
end)
Thats all I know If I don't forget one thing, enjoy !