How to cut off a imagelabel when I reach the end of my GUI

Hi,

I’m trying to achieve a way to cut off my image label and frame when I reach the end of my GUI. I’m trying to achieve a mouse cursor within a monitor, which obviously the mouse shouldn’t be able the leave the monitor. I’ve tried messing around with canvas size, but I’m not exactly sure how it works. Does anyone have a solution or somewhere they can point me to? (Devhub is pretty much empty)

Thanks!

Maybe try ClipDescendats? I am not really sure what you want to achieve exactly.

So Imagine I have a cube with a button in it. The button moves randomly around the cube, but I don’t want the button to go outside of the cube (the player must always see it).

Then just script is so the cube won’t go outside.

I don’t want the button to go outside of the cube

I am also trying to achieve the button to go where my mouse cursor goes. Would you think it’s better to just change the entire cursor?

Alright so:

To achieve following cursor:

local Mouse = game:GetService("Players").LocalPlayer
local YourButton = script.Parent

Mouse.Move:Connect(function()
YourButton.Position = Mouse.Hit.Position
end)