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

Why does my script.Parent Transparency not work?

for i = 1,100 do
wait(0.01)
	script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + 0.01
	script.Parent.TextTransparency = script.Parent.TextTransparency + 0.01
	script.Parent.Parent.Stand.BackgroundTransparency = script.Parent.Parent.Stand.BackgroundTransparency + 0.01
	script.Parent.Parent.Stand.TextTransparency = script.Parent.Parent.Stand.TextTransparency + 0.01
	script.Parent.Parent.Desc1.TextStrokeTransparency = script.Parent.Parent.Desc1.TextStrokeTransparency + 0.01
	script.Parent.Parent.Desc1.TextTransparency = 	script.Parent.Parent.Desc1.TextTransparency + 0.01
	if script.Parent.Parent.StandClass.BackgroundTransparency < 1 then
		script.Parent.Parent.StandClass.BackgroundTransparency = script.Parent.Parent.StandClass.BackgroundTransparency + 0.01
		script.Parent.Parent.StandClass.TextStrokeTransparency = script.Parent.Parent.StandClass.TextStrokeTransparency + 0.01
		script.Parent.Parent.StandClass.TextTransparency = script.Parent.Parent.StandClass.TextTransparency + 0.01
	end
	end

For some reason, "StandClass" and "Desc1" turn transparent, but "sit"(which is script.Parent), doesn't turn transparent. I don't know if it is ROBLOX or me, but it doesn't work no matter what I try. Is there something wrong?

2 comments

0

You should use variables. This is entirely excessively long and confusing.

0

Alright, I'll edit soon.

1 answer

You should use variables and functions to shorten your code.

function fade(label, t)
	label.BackgroundTransparency = t
	label.TextTransparency = t
	label.TextStrokeTransparency = t
end

local label = script.Parent
local container = label.Parent
for t = 0, 1, 0.03 do
	-- from 0 to 1 by 0.03
	wait(0.03) -- can't wait for 0.01
	fade(label, t)
	fade(container.Stand, t)
	fade(container.Desc1, t)
	if container.StandClass.BackgroundTransparency < 1 then
		-- This if seems redundant since it ought to be true?
		fade(container.StandClass, t)
	end
end

This should affect them all equally.

Are you sure you aren't misinterpreting which object the not-transparent thing is (e.g., some frame in the background perhaps?)

1 comment

0

Actually, I think I am. However, I don't know what the not-transparent thing is because I checked the frame & everything inside it, but when I put their transparency as 1, it is still there...

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