If my question title seems confusing, then I mean like when you see in game its like
"Welcome to my game....." the gui turns black then another GUI slowly fades in saying
"Made by [person]" Yea. I'm trying to make that
Code that is the problem:
for i = 0, 1, 0.1 do local b = PlayerGui.Checkpoints.EndofLevel.End.Background1.Holder1.Loading local a = PlayerGui.Checkpoints.EndofLevel.End.Background1.Holder1.LoadingNew b.Transparency = i wait(3) for i = 1, 0.1, 1 do a.Tansparency = i end end
Whole code:
function Touch(Item) if Item.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(Item.Parent) then local PlayerGui = game.Players:GetPlayerFromCharacter(Item.Parent).PlayerGui PlayerGui.Checkpoints.EndofLevel.End.Background1.Visible = true wait(5) for i = 0, 1, 0.1 do local b = PlayerGui.Checkpoints.EndofLevel.End.Background1.Holder1.Loading local a = PlayerGui.Checkpoints.EndofLevel.End.Background1.Holder1.LoadingNew b.Transparency = i wait(3) for i = 1, 0.1, 1 do a.Tansparency = i end end PlayerGui.Checkpoints.EndofLevel.End.Background1:remove() print('work') if workspace.Level1.SL2.Enabled == true then workspace.Level1.SL2.Enabled = false workspace.Level2.SL3.Enabled = true end end end script.Parent.Touched:connect(Touch) function onTouch(hit) local b = hit.Parent:FindFirstChild("Humanoid") if b ~= nil then b.Health = 0 else print("noooo") end end script.Parent.Touched:connect(onTouch)
What your code is trying to do, is loop 10 times, increasing the "i" variable from 0 to 1 and setting the transparency of b to i. That is perfectly fine. The problem is, every time this loops, there is another loop which is trying to loop from 1 to 0.1 with in increment of 1 which, obviously, won't work.
(Also the property is BackgroundTransparency, not Transparency)
Try the following code:
local b = PlayerGui.Checkpoints.EndofLevel.End.Background1.Holder1.Loading local a = PlayerGui.Checkpoints.EndofLevel.End.Background1.Holder1.LoadingNew --This first loop will fade b in-- for i = 1, 0, 0.1 do --Will loop ten times b.BackgroundTransparency = i --Setting the transparency of b to i wait(0.1) --So it doesn't instantly change transparency to 0 end wait(3) --Time period before the next one fades in for i=1, 0, 0.1 do --Will loop 10 times a.BackgroundTransparency = i --Will make a visible b.BackgroundTransparency = 1-i --Will make b invisible wait(0.1) --To slow it down a bit end
Obviously I can't see your GUI, but if you don't want to make b invisible at the end, just remove line 15.
I hope this helps!