NEED HELP: Tweening a U.I's transparency in and out

Hey, it’s been a while since I posted and on my most recent game I am trying to code a zoning system, I have already completed the basic part and I just need to tween the transparency (if possible) in and out. My code is very messy because this is one of the first times I’ve coded and I’m using Roblox’s documentation and tutorials as my main. (Sorry coders who know 1000x more efficient ways)

local event = game.ReplicatedStorage:WaitForChild("Aves")
local UI = game.Players.LocalPlayer.PlayerGui:WaitForChild("Area")
local indicator = UI.Aves_Image
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5)

event.OnClientEvent:Connect(function(inOrOut)
	if(inOrOut == "In") then
		local tween1 = TweenService:Create(UI.Aves_Image, TweenInfo, {Transparency = .0})
		indicator.Visible = true
		local tween1 = TweenService:Create(UI.Aves_Image, TweenInfo, {Transparency = 1})
		wait(5) indicator.Visible = false
		local tween1 = TweenService:Create(UI.Aves_Image, TweenInfo, {Transparency = .0})
	else
		indicator.Visible = false
	end
end)

tween1:Play()
tween2:Play()

(I do have another script that’s connecting to this, if you might need that to help I can give it.

local event = game.ReplicatedStorage:WaitForChild("Aves")
local UI = game.Players.LocalPlayer.PlayerGui:WaitForChild("Area")
local indicator = UI.Aves_Image
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5)

event.OnClientEvent:Connect(function(inOrOut)
    if inOrOut == "In" then
        indicator.Visible = true
        local tweenIn = TweenService:Create(indicator, tweenInfo, {Transparency = 0})
        tweenIn:Play()
        wait(5)
        local tweenOut = TweenService:Create(indicator, tweenInfo, {Transparency = 1})
        tweenOut:Play()
        indicator.Visible = false
        local tweenReset = TweenService:Create(indicator, TweenInfo.new(0), {Transparency = 0})
        tweenReset:Play()
    else
        indicator.Visible = false
    end
end)

1 Like

Okay, so I did a bit of changing, and got no result is there any way to change Transparency = 0 to ImageTransparency = 0?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.