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

Mouse-leave Function Does Not Respond fast enough?

Hellooooooooooooooooooooooooooooooooooooooooooooooooooo, im making it when you hover your mouse over a GUI button it comes into frame and when you don't it goes back out of frame

It works.......Half, if you move your mouse to fast the button does'nt respond and it does not go back out of frame....i tried using the spawn function and still does not work...

Here is the Local Script

script.Parent.MouseEnter:Connect(function()
	spawn(function()
	local sound = script.Sound:Clone()
	sound.Parent = game.Players.LocalPlayer
	sound:Play()
	delay(2, function()
		sound:remove()
	end) --Just Plays a sound when hovering over it

	script.Parent:TweenPosition(UDim2.new(0.915, 0,0.339, 0), "Out", "Quad", 0.2)
	end) --Tweens it into frame
end)

script.Parent.MouseLeave:Connect(function()
	spawn(function()
	script.Parent:TweenPosition(UDim2.new(0.977, 0,0.339, 0), "Out", "Quad", 0.2)
	end) --Tweens it Out Of Frame
end)

1 comment

0

what is delay?

1 answer

✓ Accepted answer

This is veryyyyyyyyy simple, simply turn on Tween Override (Which is false by default), lemme show you how

script.Parent.MouseEnter:Connect(function()
    spawn(function()
    local sound = script.Sound:Clone()
    sound.Parent = game.Players.LocalPlayer
    sound:Play()
    delay(2, function()
        sound:remove()
    end) --Just Plays a sound when hovering over it

    script.Parent:TweenPosition(UDim2.new(0.915, 0,0.339, 0), "Out", "Quad", 0.2, true) -- Turn on Tween Override
    end) --Tweens it into frame
end)

script.Parent.MouseLeave:Connect(function()
    spawn(function()
    script.Parent:TweenPosition(UDim2.new(0.977, 0,0.339, 0), "Out", "Quad", 0.2, true) -- Same with this
    end) --Tweens it Out Of Frame
end)

Hope it helped

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