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

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

Asked by
Resnex 60
10 years ago
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.

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. Bman8765 270 — 10y
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. TheeDeathCaster 2368 — 10y
0
What isn't working about this? Does it do nothing? Error? Do something but not what you want? BlueTaslem 18071 — 10y

1 answer

Log in to vote
-1
Answered by
RedCombee 585 Moderation Voter
10 years ago

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
0
You did not correctly fire the Event. TheeDeathCaster 2368 — 10y
0
Red your code is useless. ConnorVIII 448 — 10y
Ad

Answer this question