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

Why won't these texts disappear?

So this script won't remove the text, i've tried it with texttransparency and other stuff... But it just won't work, but it prints everything. It appears but it won't disappear, that's all

local warning = script.blckScreen.blck
local s = warning.Info
local blckscreen = script.blckScreen

game.ReplicatedFirst:RemoveDefaultLoadingScreen()

blckscreen.blck.Visible = true

wait(2)

print("text incoming")

for i = 1,100 do
	wait(0.05)
		s.TextTransparency -= 0.1
		s.Headphones.TextTransparency -= 0.1
		s.TextLabel1.TextTransparency -= 0.1
		s.TextLabel2.TextTransparency -= 0.1
		print("pluss 1")
end

print("its gonna disappear")
	
wait(2)
	
for i = 1,10 do
	wait(0.05)
		s.TextTransparency += 0.1
		s.Headphones.TextTransparency += 0.1
		s.TextLabel1.TextTransparency += 0.1
		s.TextLabel2.TextTransparency += 0.1
		print("plus 1")
end

print("its gone (maybe)")

1 answer

✓ Accepted answer

The issue lies within the for loop on line 13:

for i = 1,100 do

Right now, you have the loop making a hundred iterations. The outcome, the object's transparency is set to -9 instead of 0.

Changing the 100 to a 10 should solve your issue:

for i = 1,10 do

There are some tweaks I'd like to make to your loops though:

for i=1,0,-0.1 do -- intializing i as 1, with its conditional final value being 0, and its increment value -0.1
	-- setting each property to i
	s.TextTransparency=i
	s.Headphones.TextTransparency=i
	s.TextLabel1.TextTransparency=i
	s.TextLabel2.TextTransparency=i
	wait(0.05)
end

wait(2)

for i=0,1,0.1 do -- intializing i as 0, with its conditional final value being 1, and its increment value +0.1
	-- setting each property to i
	s.TextTransparency=i
	s.Headphones.TextTransparency=i
	s.TextLabel1.TextTransparency=i
	s.TextLabel2.TextTransparency=i
	wait(0.05)
end

While your original code produces a similar output, I think this will make it more convenient for you. For loops have a third optional value that is read as the increment. As you can see above, having +0.1 as the increment value will, well, increment variable i by +0.1. You can read more about for loops here.

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