So I have a script that will load Online mode when the online button is pressed, but that function happens before i can even press the button! also when loading "finishes" it won't let me click another button "in debugging". what happenes is that after it finishes loading, it says "15:33:40.351 - Attempt to connect failed: Passed value is not a function, 15:33:40.362 - Script 'Players.Player.PlayerGui.StartupScreen.StartupLogic', Line 61" and then it says "15:33:46.988 - attempt to call a nil value" when I click a button(the active one, online button)
Here is the code, and if you could please help me, ive done all the debugging , my self (that i can, till i gave up) and it doent show me.
Here is the Console:
15:33:40.351 - Attempt to connect failed: Passed value is not a function
15:33:40.362 - Script 'Players.Player.PlayerGui.StartupScreen.StartupLogic', Line 61
15:33:40.363 - Stack End
15:33:46.988 - attempt to call a nil value
15:38:23.153 - Auto-Saving...
15:43:23.220 - Auto-Saving...
Here is the Code:
--define all variables local OnlineButton = script.Parent.Frame.OnlineButton local StoryButton = script.Parent.Frame.StoryButton local RandomModeButton = script.Parent.Frame.RandomModeButton local Console = script.Parent.Frame.Console local OnlineAvaliable = game.Workspace.OnlineAvaliable.Value local modes = {"story", "online"} --functions function clearConsole(textToClear, clear) if textToClear and clear then textToClear.Text = "" else print "Error 01, unable to clear" Console.Text = "Unable to clear, Error 01 \n" end end function onClickPlay(doLoad, mode) if doLoad and mode == modes[1] then print'Loading story mode' clearConsole(Console, true) for i = 1, 10 do Console.Text = "Loading Story Mode." wait(0.8) Console.Text = "Loading Story Mode.." wait(0.8) Console.Text = "Loading Story Mode..." wait(0.8) end end if doLoad and mode == modes[2] and OnlineAvaliable == true then clearConsole(Console, true) for i = 1, 10 do Console.Text = "Loading Ejected Online." wait(0.8) Console.Text = "Loading Ejected Online.." wait(0.8) Console.Text = "Loading Ejected Online..." wait(0.8) end end end OnlineButton.MouseButton1Down:connect(onClickPlay(true, modes[2]))