I've had a similar issue assigning variables to properties in lighting, where the only way to change the values in the lighting folder are to go through the entire hierarchy. in this code, working with a GUI and text label properties, I have the same problem:
plr = game.Players.LocalPlayer Start = true Cheese = 0.1 TextTrans = plr.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency TextBorderTrans = plr.PlayerGui.ScreenGui.Frame.TextLabel.TextStrokeTransparency function Study() if Start == true then Start = false for i = 0, 1, 0.1 do wait(1) plr.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency = i plr.PlayerGui.ScreenGui.Frame.TextLabel.TextStrokeTransparency = i --TextTrans = i --TextBorderTrans = I <<this is what I'd rather use, but it wont work unless I do it the way I have above. end end end game.Workspace.PAT.Touched:connect(Study)
am I defining the variables wrong, making another mistake, or is it not possible to use variables in this way? I've tested the values and they aren't nil, they hold number values like they should- but I cant seem to change them using any loop/iterator unless I go down through the game to them specifically.
Variables are values
Oh, hi... Dave.
Values like Transparency
and such are literally just numbers. Numbers. Full-stop. They don't know where they came from, they don't care where they came from. If you try and set it to a variable, and you change the variable, you did exactly that - You changed the variable. Now, if you set the Object to a variable, and then you change its Transparency
, then you're changing the transparency.
plr = game.Players.LocalPlayer Start = true Cheese = 0.1 Text = plr.PlayerGui.ScreenGui.Frame.TextLabel function Study() if Start == true then Start = false for i = 0, 1, 0.1 do wait(1) Text.TextTransparency = i Text.TextStrokeTransparency = i end end end game.Workspace.PAT.Touched:connect(Study)