I used an Activated event to trigger this function. It works on PC but on mobile the button just goes dark when I click it, but no menu pops up. I know that the If parameter for ContinueScreen doesn't mess with it, I tried removing it and testing on mobile but same result.
Script:
01 | button.Activated:connect( function () |
02 | if ( not main:FindFirstChild( "ContinueScreen" )) or (main:FindFirstChild( "ContinueScreen" ) and main.ContinueScreen.Visible = = false ) then |
03 |
04 | menu.Position = UDim 2. new( 0 , 0 , 0.2 , 0 ) |
05 |
06 | Sound.Pitch = 1 |
07 | Sound:Play() |
08 | if button.Title.Text = = "Menu >" then |
09 | button.Title.Text = "Menu <" |
10 | button.Title.DropShadow.Text = button.Title.Text |
11 | char.Humanoid.WalkSpeed = 0 |
12 | menu:TweenPosition(UDim 2. new( 0 , 0 , 0.2 , 0 ), "Out" , 'Quad' ,. 25 , true ) |
13 | elseif button.Title.Text = = "Menu <" then |
14 | Sound.Pitch = 1 |
15 | Sound:Play() |
I probably made a stupid mistake but if anyone is free to help I thank you in advance.
Here's code with my explanation, let me know if you run into any issues.
01 | local MenuOpened = false -- I believe a variable might be good for this scenerio. |
02 |
03 | --[[ |
04 | Consider using InputBegan, it's widely used and easy to figure out. |
05 |
06 | If you're wondering... |
07 |
08 | UserInputType is the type of input recieved (keyboard, mouse, touch). |
09 | UserInputState is the state of the input (begin, end, changed). |
10 | ]] |
11 |
12 | button.InputBegan:Connect( function (InputObject) |
13 | if InputObject.UserInputType = = Enum.UserInputType.MouseButton 1 or InputObject.UserInputType = = Enum.UserInputType.Touch and InputObject.UserInputState = = Enum.UserInputState.Begin then |
14 | MenuOpened = not MenuOpened |
15 | if not main:FindFirstChild( "ContinueScreen" ) or (main:FindFirstChild( "ContinueScreen" ) and main.ContinueScreen.Visible = = false ) then |
I just changed my original event which had MouseButton1Click into MouseButton1Down. For some reason it fixed everything, found it on some roblox dev forum or something. Thanks for trying to answer my question!