-
What do you want to achieve?: Detect touch input from ImageButton
-
What is the issue?: Works perfectly with mouse input, but nothing happens with touch input (No error messages in output as well). I’ve used this method in other applications and it works flawlessly, not sure why I’m having an issue with it now.
-
What solutions have you tried so far?: Tried GuiObject.Activated, as well as InputBegan
I’m using a for loop to iterate through a lot of ImageButtons
for _,vehicle in ipairs(CarPreviews:GetChildren()) do
nextCarPreview = CarPreview:Clone()
nextCarPreview.Name = vehicle.Name
setViewport(vehicle, nextCarPreview)
local clickedFrame = nextCarPreview.Clicked
local function SelectVehicle()
showFrame(clickedFrame)
end
nextCarPreview.Activated:Connect(SelectVehicle)
nextCarPreview.Parent = SelectionFrame
end
Functions being used for opening and closing a frame within each ImageButton:
function hideAllFrames()
for _,preview in ipairs(SelectionFrame:GetChildren()) do
if preview:IsA("ImageButton") then
preview.Clicked.Visible = false
print("not visible")
end
end
end
function showFrame(frame)
hideAllFrames()
frame.Visible = true
print("visible")
end