Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I be able to do this with UserinputService ?

Hey guys. So I disabled the topbar and when i tried to click on a button where the topbar area is, it wouldn't work because it's blocking mouse clicks and such.

I found out a close idea on how I can work around this, but I need some help. I want to use UserinputService (Began / Ended) to read the coordinates of a mouse click. If the click is within the button's coordinates, it should print something.

Would be great if i can use an example!

9 comments

0

Does UIS work with mouse input? I know InputBegan doesn't. I think you have to use InputChanged. Why can't you just use MouseClick on the mouse?

0

As long as it does what i want it to do i'm completely fine whatever the method

0

This is a totally feasible strategy, go try it!

0

I'm asking for help and one of the top members of SH tell me 'go try it'. ok bye, thank you for wasting 3 hours of my time.

0

Yup, you gotta supply your attempt. The only reason I didn't close it is because you at least thought about the method. You still need to attempt some code, tho. Come back if you have trouble with it.

0

All i needed was wiki links, this site really sucks tbh when there's not the right person helping out. (you)

0

Everything you might need you can find here: http://wiki.roblox.com/index.php?title=API:Class_reference . The classes are on the left, or you can use the Search bar to get to the class you want to know more about.

0

I want to bash my head off a wall. The scripters forum in roblox has a better response time and the responses are A grade. Pointless website.

0

Umm I don't think that UserInputService works with the mouse. You might want to look into game.Players.LocalPlayer:GetMouse() and try and do stuff with that.

1 answer

For anybody that might find this useful, I finally got the answer. It should work :)

Solution:

local Player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local Mouse =	Player:GetMouse()

uis.InputBegan:connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print(Mouse.X..","..Mouse.Y)
	end
end)


This discussion is preserved as it was. New answers, comments, and votes are closed.