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

How can I change the BorderSizePixels on a GUI onHover?

What am I doing wrong?

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

while wait() do
	if Mouse.Target ~=nil and Mouse.Target.Name == 'HoverBrick' then
		script.Parent.BorderSizePixel = 5
			else
		script.Parent.BorderSizePixel = 1
	end
end

1 answer

✓ Accepted answer

I can't see any problems that might be occurring.

Try this code, and make sure it's in an Enabled LocalScript, put where it will run:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.Move:connect(function()
	if Mouse.Target ~=nil and Mouse.Target.Name == 'HoverBrick' then
		script.Parent.BorderSizePixel = 5
	else
		script.Parent.BorderSizePixel = 1
	end
end)

Failing that, try enabling Output and see if any red text gets spit out at you.

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