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

How can I have multiple objects fade from one function?

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.

Here's the script (Sorry, I forgot it):

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,20),"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") 
ErrorToPlayer(game.Players.Player1,"HEY") 
ErrorToPlayer(game.Players.Player1,"HEY")

2 comments

0

This really is a question about what you are doing wrong in your implementation -- can you provide what you've tried so that we can see what needs fixing?

0

Edited post.

1 answer

gui = {ScreenGui.Frame,ScreenGui2.Frame,ScreenGui3.Frame}
for i,v in pairs (game.Players:GetPlayers() ) do
for i = 1,#gui do
v:WaitForDataReady("ScreenGui").gui[i].Transparency  = 0.2
wait()
v:WaitForDataReady("ScreenGui").gui[i].Transparency  = .5
wait()
v:WaitForDataReady("ScreenGui").gui[i].Transparency  = 1

end
end

This script is very badly written but works best hopes HexC3D , took me like 1 min :)

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