Custom UI Hitbox

local button = script.Parent
local absolutesize,absoluteposition = button.AbsoluteSize,button.AbsolutePosition
local radii = absolutesize.Magnitude/2
local runservice,userinputservice = game:GetService("RunService"),game:GetService("UserInputService")

runservice.RenderStepped:Connect(function()
	if (userinputservice:GetMouseLocation()-(absoluteposition+Vector2.new(absolutesize.X/2,absolutesize.Y))).Magnitude <= radii then
		print("YA")
	end
end)

I tested it and it works.

Thank you! It works now after days of suffering.

Oh… days?? Well just let me know if you got any scripting issues… Ill fix it <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.