I have a script that detects that the mouse button 1 is down, as well as if the input started within the bounds of the label. The issue is that I’m not sure how to check if it’s within the bounds. I was thinking of using MouseEnter, but I’m not sure if I can because there are buttons above it, and therefore, I don’t think it would detect the mouse entering it.
Here’s what I have so far:
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton1 then
local mouse = game.Players.LocalPlayer:GetMouse()
local x = mouse.X
local y = mouse.Y
print(x,y)
end
end)
What do you mean by signifying where the script is? I should add that it’s basically a switch to turn off or on settings, and I kind of want the player to be able to “drag” the switch off or on, only if the input started within the switches’ bounds.
I will read up on that, thanks!
This could work, do you think it would cause some problems though, if it’s looping a lot? I could do some if statements to have it not execute but it’s still a concern for me. I will try this as well as the others’ suggestions.