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

Disable Rotation of MouseLeave?

Asked by 6 years ago
Icon.MouseEnter:connect(function()
    while wait(0.1) do
        IconBorder.Rotation = IconBorder.Rotation + 5
        end
end)

Icon.MouseLeave:connect(function()
    while wait(0.1) do
    IconBorder.Rotation = 0
    end
end)

When the Mouse Leaves, the rotation doesn't stop. Anyway to do this?

0
Try adding a debounce to each function and see if that works. If you need help with that, try looking at http://wiki.roblox.com/index.php?title=Debounce User#18979 5 — 6y

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

hello, ackalota !

I think I know why your script isn't working properly! This can be because when you starts a loop, it only stops when the var comes false(in this case, the var is "wait(0.1)"

this var can't never go to false, so the while will run infinitly

try adding something like debounce!

Tested (and working) example:

local mouseOut = false
Icon.MouseEnter:connect(function()
    while mouseOut == false  do
    wait(0.1)
        IconBorder.Rotation = IconBorder.Rotation + 5
        end
end)

Icon.MouseLeave:connect(function()
    mouseOut = true
    wait(0.2)
    mouseOut = false
    IconBorder.Rotation = 0
end)

Don't forget to properly set the "Icon" and "IconBorder" variables!

-- For more information about Debounce, acess: http://wiki.roblox.com/index.php?title=Debounce

Good luck with your game!

0
Yes this works, but the problem is, unlike the other one, it isn't smooth. It looks super pixelated. jackalota 9 — 6y
0
ok, change the "IconBorder.Rotation = IconBorder.Rotation + 5" to "IconBorder.Rotation = IconBorder.Rotation + 1" This should fix Leamir 3138 — 6y
0
Pixelated.... It's roblox graphics, we can't make anithing about it, sorry Leamir 3138 — 6y
Ad

Answer this question