I'm making a tool with multiple modes, would this be sufficent?
local mode = script.Parent.Mode if mode.Value== 1 then --Do stuff elseif mode.Value == 2 then --do stuff elseif mode.Value == 3 then -- do stuff elseif mode.Value == 4 then -- do stuff end
Would this cause a problem, in my tool? I'm still learning, I just posted this question as a precaution. Thanks
What bobafett3544 attempted to say was, that you need a Changed event, or some sort of loop. I apologize if I misunderstood you, boba.
local mode = script.Parent.Mode mode.Changed:connect(function() if (mode.Value == 1) then --Do stuff elseif (mode.Value == 2) then --do stuff elseif (mode.Value == 3) then -- do stuff elseif (mode.Value == 4) then -- do stuff end end)
Yes, this would work, but of course, you'd need something to change the event. Here's a function that will change modes for you, so you don't have to type mode.Value all the time.
function changeMode(newMode) local mode = script.Parent.Mode mode.Value = newMode end