Hello)
Could you help me solve this problem, I just do not understand.
So:
I want to create a script “Press F to pick up”, which (as I understand it) should contain these events:
Firstly, in the object should be a ClickDetector which intercepts the mouse hovering through the Script
script.Parent.ClickDetector.MouseHoverEnter: Connect (function (plr)
print("HOVERED")
end)
Secondly, in the local script is intercepting the pressed button
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
function onKeyPress (inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F then
print("PRESSED")
end
end
These events are in different scripts, how to intercept when they both work and then perform the necessary operations?
As I understand it, the capture of buttons on the keyboard should be a local script. To capture ClickDetector mouse hover should be a script.
Maybe there is some other way that works in one script?
THX :)

1 comment
Wow. It turned out to be easier than I thought. The only thing I replaced the Mouse.KeyDown function with UserInputService since I read that Roblox does not advise using it anymore because it is outdated. Thanks bro)