Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How can I change the BorderSizePixels on a GUI onHover?

Asked by 10 years ago

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

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

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.

Ad

Answer this question