I have been scripting for 2 weeks now, my question is how can i possibly call 2 functions under 1 event, for example if I am trying to create a animated button door how am i gonna make the functions not run at the same time ?
Thanks
I have been scripting for 2 weeks now, my question is how can i possibly call 2 functions under 1 event, for example if I am trying to create a animated button door how am i gonna make the functions not run at the same time ?
Thanks
You just need to use if and elseif statements:
local Opened = false
script.Parent.MouseClick:Connect(function() --Script is located in a "ClickDetector"
if Opened == false then --Checks to see if it's false
Opened = true --sets to true
print("Door is open")
elseif Opened == true then --If the value is not false it immediately runs this part
Opened = false
print("Door is closed")
end
end)
More info about if statements/Conditional statements: https://developer.roblox.com/en-us/articles/Conditional-Statements-in-Lua
function a()
print("bruh")
end
function b()
print("moment")
end
event:Connect(function()
a()
b()
end)
>>>bruh
>>>moment
do you mean something like this?
no i mean how do i make the door open when i press the button and how do i make it close when i press the button again
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
thank you so much, now my night vision button script is completed, your answer will be have a huge impact over my future goals