I have a system that relies on the mouse up and down events but when I release my mouse on a gui button, it seems to not fire at all. How can I fix this?

I have a system that relies on the mouse up and down events but when I release my mouse on a gui button, it seems to not fire at all. How can I fix this?

This problem happens with everyone on pc and I think using UserInputService can fix that. Just add Input Ended instead of MouseUp.
local InputService = game:GetService("UserInputService")
InputService.InputBegan:Connect(function(Input)
--code
end)
--to start the code
InputService.InputEnded:Connect(function(Input)
--code
end)
--to END the code
but that I think is used for keys and buttons on controllers, phones pc and stuff.
Okay but what is the mouse button 1 up??
inputEnded, the input (press) stopped