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

LUA hover script broken?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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)
0
thank you works now! realspydude117 2 — 3y
Ad

Answer this question