Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my script.Parent Transparency not work?

Asked by 10 years ago
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?

0
You should use variables. This is entirely excessively long and confusing. BlueTaslem 18071 — 10y
0
Alright, I'll edit soon. LOLOLOLOLMRocks37Alt 5 — 10y

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

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?)

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... LOLOLOLOLMRocks37Alt 5 — 10y
Ad

Answer this question