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

I'm having a problem with MouseEnter:connect(), any ideas?

local Test = script.Parent.TextLabel

function onEnter(Label)
repeat
Label.Position = script.Parent.Mover.Position + UDim2.new(0, .01, 0, 0)
wait(.025)
until Label.Position == UDim2.new(0, .025, 0, .3)
end

Test.MouseEnter:connect(onEnter)

What I'm trying to do is get the TextLabel to move when you mouse over it. Any solutions?

Thanks.

3 comments

0

I don't have a solution but I don't think you can use UDim2.new(num, num, num, num) as a "requirement" before stoping the repeat.

0

Try replacing the 'TextLabel' with a 'TextButton', or is there already one? [EDIT} Sorry, I meant to replace the TextLabel with a TextButton instance to see what happens.

0

What isn't working about this? Does it do nothing? Error? Do something but not what you want?

1 answer

Your code has an argument. You're not setting the argument to anything when you call the function. This should fix the problem:

local Test = script.Parent.TextLabel

function onEnter(Label)
repeat
Label.Position = script.Parent.Mover.Position + UDim2.new(0, .01, 0, 0)
wait(.025)
until Label.Position == UDim2.new(0, .025, 0, .3)
end

Test.MouseEnter:onEnter(Test) -- Problem should be fixed here

2 comments

0

You did not correctly fire the Event.

0

Red your code is useless.

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