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

Fading multiple frames with one function - Not working?

Asked by
Vrakos 109
10 years ago

Lets say that I have a function that places a gui and makes it fade after 5 seconds, but I call the function three times and there's three frames.

Whenever I try this, two don't fade but the last one that was created does.

I'm really confused with this.

GUIs                = game.ServerStorage.GUIs

function ErrorToPlayer(Player,Err)
    coroutine.resume(coroutine.create(function()
        for Index,Gui in pairs(Player.PlayerGui.PlayerClick:GetChildren()) do
            if Gui.Name == "Error" then
                Gui:TweenPosition(Gui.Position+UDim2.new(0,0,0,25),"InOut","Quad",.25,true)
            end
        end
        Error = GUIs["Error"]:Clone() 
        Error.Text = Err 
        Error.Parent = Player.PlayerGui.PlayerClick
        game.Debris:AddItem(Error,6)
        wait(5)
        for i = 0,1,.1 do
            Error.BackgroundTransparency = 1-.5*i
            Error.TextTransparency = i
            Error.TextStrokeTransparency = 1-.5*i
            wait()
        end
    end))
end

ErrorToPlayer(game.Players.Player1,"HEY")
wait(.25)
ErrorToPlayer(game.Players.Player1,"HEY")
wait(.25)
ErrorToPlayer(game.Players.Player1,"HEY")

Answer this question