Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How to detect player interaction in GUIs?

Asked by
ben0h555 417 Moderation Voter
6 years ago

I want to use UserInputService, but I need a way to detect if the player is interacting with Guis, including them typing in roblox's chat. I am extreamly stuck with this manner and I have no idea how to do this.

0
You could use UIS.TextBoxFocused and FocusReleased. You also use the gameProcessedEvent parameter in InputBegan. What exactly are you trying to do though? xPolarium 1388 — 6y
0
if you find nothing else, this is the alternative Gui.MouseEnter:Connect(function() end) Zafirua 1348 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

It mostly depends on what gui element your going to have them interact with. For a button of any type.

local guiElement = script.Parent --This assumes the gui element is the scripts parent

guiElement.MouseButton1Click:Connect(function()
    --Do something
    end)

--This is a local script

And if you wanted to see when a user sends a message in chat you would use:

game.Players.LocalPlayer.Chatted:Connect(function(chat)
    --Do something
end)
--This is also a local script

There isn't any event for when the player starts typing in chat though. So there isn't a 100% reliable way to see when a player is typing in chat without redoing the whole chat gui.

If this answer helped be sure to accept it so we both get some rep :)

0
Im pretty sure game.Players.LocalPlayer.Chatted doesnt fire when they are typing. ben0h555 417 — 6y
Ad

Answer this question