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

Appearing and dissapearing textlabel not changing transparency?

So I'm making a game and I'm trying to get this text label to fade in, then fade out, the text will change, and then fade back in with different text, and finally, the script will be deleted once it is all over. (This is in a local script) everything seems to be working, there are no developer console warnings, but the text just stays transparent. I've tried using the print function to verify if it goes all the way through, and it does.

startingd = Instance.new("TextLabel", game.StarterGui.d1gui) --[[d1gui is the name of the screen gui in startergui]]--
	startingd.Name = "Dialog1"
	startingd.BackgroundTransparency = 1
	startingd.Position = UDim2.new(0.313, 0, 0.918, 0)
	startingd.Size = UDim2.new(0, 717, 0, 63)
	startingd.Font = "Fantasy"
	startingd.TextSize = "Size30"
	startingd.Text = "Finally, I've made it to the checkpoint."
	startingd.TextTransparency = 1
	startingd.TextColor3 = Color3.new(255, 255, 255)
	wait(2)
for dtexttrans = 1, 0, -.1 do
	startingd.TextTransparency = dtexttrans
	print("It is working!")
	wait(.05)
end
	wait(5)
for dtextfade = 0, 1, .1 do
	startingd.TextTransparency = dtextfade
	print("It is working, again!")
	wait(.01)
end
	wait(2)
	startingd.Text = "I should keep going, no point in standing out in the rain."
for dtexttrans2 = 1, 0, -.1 do
	startingd.TextTransparency = dtexttrans2
	wait(.01)
end
	wait(6)
for dtextfade2 = 0, 1, .1 do
	startingd.TextTransparency = dtextfade2
	wait(.01)
end
print("Goodbye cruel world :'(")
game.StarterGui.d1gui.Dialog1:Destroy()
wait(.01)

If I instead try to reverse it and have it be visible at the start, the values dont change and it stays visible. I can't seem to figure out the issue, and I am new to scripting.

3 comments

0

on line 2 for some reason in this it is labeled as being text, it isnt like that in roblox script editor.

0

Also, for line 7, it takes a number, not a string.

1 answer

The Problem here is on line 1 startingd = Instance.new("TextLabel", game.StarterGui.d1gui)

this creates a text label in starterGui.

but starter gui is just a folder developing guis and is replicated to PLayerGui on respawn, and not the actual player's screen.

instead, you should use game.Players.LocalPlayer.PlayerGui.d1guiso that the actual player gui is referenced

Notes(unrelated to te problem)

TextSize is a number not string

using a parent in instance.new() is deprercated now

and Color3 does not use 255 RGB values but are out of 1

startingd = Instance.new("TextLabel", game.Players.LocalPlayer.PlayerGui.d1gui) --[[d1gui is the name of the screen gui in startergui]]
    startingd.Name = "Dialog1"
    startingd.BackgroundTransparency = 1
    startingd.Position = UDim2.new(0.313, 0, 0.918, 0)
    startingd.Size = UDim2.new(0, 717, 0, 63)
    startingd.Font = "Fantasy"
    startingd.TextSize = 30
    startingd.Text = "Finally, I've made it to the checkpoint."
    startingd.TextTransparency = 1
    startingd.TextColor3 = Color3.new(1, 1, 1)
    wait(2)
for dtexttrans = 1, 0, -.1 do
    startingd.TextTransparency = dtexttrans
    print("It is working!")
    wait(.05)
end
    wait(5)
for dtextfade = 0, 1, .1 do
    startingd.TextTransparency = dtextfade
    print("It is working, again!")
    wait(.01)
end
    wait(2)
    startingd.Text = "I should keep going, no point in standing out in the rain."
for dtexttrans2 = 1, 0, -.1 do
    startingd.TextTransparency = dtexttrans2
    wait(.01)
end
    wait(6)
for dtextfade2 = 0, 1, .1 do
    startingd.TextTransparency = dtextfade2
    wait(.01)
end
print("Goodbye cruel world :'(")
game.Players.LocalPlayer.PlayerGui.d1gui:Destroy()
wait(.01)

1 comment

0

ok may I ask why you're encouraging the 2nd parameter of Instance.new() when you should never use it?

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