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

Visibility not allowed within tweening?

Hello!

I am attempting to make a UI Menu within my game but am not sure as to how to go about this matter, I have a mock up script made but it seems that the problem I thought would occur, has occurred. I attached a copy of the script, and the error.

How it is supposed to work:

It is two different images where the white one turns visibility = true, then it tweens to become bigger. Then when you leave the button with your mouse It is supposed to tween back in the turn to a visibility = false. Although the visibility seems to be the thing that is making the script not work.

(First time posting so excuse any format mistakes)

local button = script.Parent

function onHoverEnter()
    script.Parent.Parent.JoinMap2.Visible = true
    local Tween = script.Parent.Parent.JoinMap2:TweenSizeAndPosition(UDim2.new(0.787, 0,0.198, 0), UDim2.new(0.05, 0,0.166, 0), 'In', 'Linear', 0.2, true)
tween:Play()
end

button.MouseEnter:Connect(onHoverEnter)

function onHoverExit()
    local Tween = script.Parent.Parent.JoinMap2:TweenSizeAndPosition(UDim2.new(0.763, 0,0.178, 0), UDim2.new(0.065, 0,0.167, 0), 'In', 'Linear', 0.2, false)
tween:Play()
    wait(0.15)
    script.Parent.Parent.JoinMap2.Visible = false
end

button.MouseLeave:Connect(onHoverExit)


https://image.prntscr.com/image/WH5g4uTJSpyQDQxuvgbrAA.png (Error that is received due to the visibility issue)

https://gyazo.com/14a8eb79772cb7610ba5449d3e9b466c (How it's currently working)

1 answer

Tween Transparency, then make a script that makes it invisible once fully transparent

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