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

LUA hover script broken?

Can anyone help with this code? All it does it goes grey then white then doesnt work

script.Parent.MouseEnter:Connect(function()
	local e = 1
	for i = 1, 10 do
		script.Parent.TextLabel.TextLabel_Roundify_4px.ImageTransparency = e - .10
		print(e)
	end

end)


script.Parent.MouseLeave:Connect(function()
	local e = 0
	for i = 1, 10 do
		script.Parent.TextLabel.TextLabel_Roundify_4px.ImageTransparency = e + .10
		print(e)
	end

end)

1 answer

✓ Accepted answer

I assume you want to change the ImageTransparency. Using Tween Service:

script.Parent.MouseLeave:Connect(function()
    local image = script.Parent.TextLabel.TextLabel_Roundify_4px

    -- The Tween
    local transparencyGoal = {ImageTransparency = 1} 
    local transparencyInfo = TweenInfo.new(1)
    local transparencyTween = TweenService:Create(image, transparencyInfo, transparencyGoal) 

   -- Play the tween
   transparencyTween:Play() 

end)

or if you want to use the loop

script.Parent.MouseLeave:Connect(function()

    -- The Image
    local image = script.Parent.TextLabel.TextLabel_Roundify_4px

    -- The Loop
    for i = 1, 1, 0.1 do
        wait(1) 
        image.ImageTransparency = i

    end
end)

1 comment

0

thank you works now!

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