All the time I’ve been working with gui’s I’ve relied on the ‘mouse’ events (MouseButton1Click, MouseButton1Down, etc) to handle input. But given the names of them, I’ve decided to look into alternatives since having ‘mouse’ in their name doesn’t feel too comforting for a game I want to be played on multiple platforms, which lead me to the Activated event.
At first thought, it seemed to be what I was looking for, since it passes an InputObject. However, I can’t seem to get it to do anything. I have a local script as a child of a text button with this code:
script.Parent.Activated:Connect(function(Input)
print("--Button--")
print("Delta:", Input.Delta)
print("KeyCode:", Input.KeyCode)
print("Position:", Input.Position)
print("UserInputState:", Input.UserInputState)
print("UserInputType:", Input.UserInputType)
end)
What is this event for and how does it work? And is it fine to rely on the ‘mouse’ events? My instincts say no, but I can’t find a proper alternative that respects all platforms.