Script working on computer but not mobile

Hey.

My script isn’t working on mobile but it works on computers. There is no UserInputService at all. Is there a way I can fix this?

LocalScript:

script.Parent.MouseButton1Click:Connect(function()
	
	local info = script.Parent.Parent.Parent.Parent.PetInfo
	
	if info.NameSelected then
		

		info.PetImage.Image = script.Parent.Image
		info.PetName.Text = script.Parent.Name
		info.PetStats.Text = game.ReplicatedStorage.Hats[script.Parent.Name].Boost.Value
		game.ReplicatedStorage.Events.GetHatData:FireServer(info.PetName.Text, info.PetStats.Text)
		
	end
	
end)

Script:

game.ReplicatedStorage.Events.GetHatData.OnServerEvent:Connect(function(plr, hatName, hatBoost)
	
	if script.Parent:FindFirstChild("HatsGui") then
		
		script.Parent.HatsGui.Frame.PetInfo.BoostSelected.Value = hatBoost
		script.Parent.HatsGui.Frame.PetInfo.NameSelected.Value = hatName
		
	end
	
end)

GuiObject | Documentation - Roblox Creator Hub This maybe?

My game works fine with MouseButton1Click, this is 0dd.

MouseButton1Click will only fire for Mouse, meaning mobile players won’t fire the event.

Although TouchTap can work, the most used event to make a TextButton compatible to computers and mobile is the Activated event.

You sure …? I mean yeah Activated seems better but MouseButton1Click fires to me on mobile;

Yes I am using MouseButton1Click on my other buttons and it works great

1 Like

I believe I saw another post about the same problem let me check. Did you try printing on MouseButton1Click? Where’s the script located?

It is parented to the Button thats why it is script.Parent

Yeah I meant it like where’s the gui but NVM. This can be useful:

O ok it was that

Thanks it worked. I replaced click with down and it magically worked. Maybe because those buttons where cloned? I am going to start using down now!

1 Like

Just a question, were they under / close to where the movement and jumping part is?

Movement , like the middle of the screen

Oh then that’s why :confused: Mobile is really annoying to support because of that

Btw i can’t like ur reply my likes ran out

1 Like