I have a script for a sell button, and it works, on PC, but not on mobile. What is confusing me the most is that I can hover over it just fine, and other textbuttons still work. I HAVE ABSOLUTELY NO IDEA WHY THIS HAPPENS, 2 of my buttons in-game don’t work (sell and another button), while every single other one works. Any help?
Is the .Active property set to true on those buttons?
yep, it is on.
character limit
Are you using MouseButton1Click
?
I stated in the title that I’m using .Activated
And it is a TextButton
? Or is it something else?
it is a TextButton
, yes.
Try changing .Activated
to .MouseButton1Click
I have already tried that, that was when I realised the buttons didn’t work on mobile, so I switched every button that had MouseButton1Click
to have .Activated
Are you catching these event by server script? Activated and other button events works strange if you connecting them on server as I saw.
not sure what you mean, but I’m assuming you’re asking if it’s a local Script or server script? It’s a local script. Correct me if I’m wrong.
Yeah, that what i was asking. Only what i can suggest it to put prints to see what running.
Already tried, matter of fact, I have a script to play a button animation when it’s pressed, and it doesn’t play it. Also doesn’t print.
not directly under, inside the sell button
By under i mean descendant, in simple words, local script wont work in workspace
well then, StarterGUI.
limit
There’s also the InputBegan
event that TextButtons have which you can test like so:
local textButton = script.Parent
local function onInputBegan(input)
if input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
or input.KeyCode == Enum.KeyCode.ButtonA
then
-- Run code inside here, example:
print(true)
end
end
textButton.InputBegan:Connect(onInputBegan)
And the GuiState
property seems to be working now in Studio so you can try this too:
local textButton = script.Parent
local function guiStateChanged()
if textButton.GuiState == Enum.GuiState.Press then
print(true)
end
end
textButton:GetPropertyChangedSignal("GuiState"):Connect(guiStateChanged)
If none of the options work, then you might have another Gui with a higher ZIndex that’s positioned in front of the TextButton that’s accidentally receiving player input instead of the button
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.