Basically, I'm trying to make it to where a single function has 6 main parameters in which only one will activate, but they each also have more lines of code to go with each specifically. Since explaining it sounds confusing, here's a small example of what I'm talking about:
script.Parent.ClickDetector.HypoFunction:connect() if integerval.Value == 1 then -- activate function val1 elseif integerval.Value == 2 then -- activate function val2 elseif integerval.Value == 3 then -- activate function val3 end end function val1() integerval.Value = 10 end function val2() integerval.Value == 20 end
Alright, so, thus far, this is very much hypothetical. I'm just curious if I could make it to where one of the elseif
statements in "HypoFunction" could cause one of the "valX" functions to trigger, effectively making one function a control set for the rest?
I suppose I could do this by making other functions activate whenever a value changes, but this isn't exactly ideal for what I need it for. If that's the only way however, I can make it work. If there are any other ways, however complex, I'd gladly take a look.
If you need any more explanation, please let me know, as to I'd love to know if this "feature" is possible or not. Thank you for reading, and I appreciate any help!
function val1() integerval.Value = 10 end function val2() integerval.Value = 20 end function val3() integraval.Value = 30 end script.Parent.ClickDetector.HypoFunction:connect() if integerval.Value == 1 then -- activate function val1 val1() elseif integerval.Value == 2 then -- activate function val2 val2() elseif integerval.Value == 3 then -- activate function val3 val3() end end
There you go :D This will work as long as it's activated and you have integerval defined.