Hi there everyone. I’ve basically ran into a bit of frustrating errors where I’ve been trying to create an intro to my new horror game, and essentially textransparency for the play button refuses to change whether or not I attempt to use the .value or not within the script. Here’s the two examples I’ve tried but miserably failed to fix the script with:
As an important side note, There’s an “auto add” script that essentially changes the play button’s parent to the parent of the current object that it’s set to by default (which is actually the auto add script). This changes the play button’s parent to OpenFrame, so I decided to add a wait timer before all the variables are called and the transparency fade for the text starts. If anyone has a fix for this, please do tell me. It would be greatly appreciated!
Make sure to update text transparency directly instead of by using variables and also remove the .Value. If you are updating the property, you don’t need the .Value at the end.
Make sure to utilize FindFirstChild() because dot syntax will look for the property, not the child.
Responding to the post below, I actually posed almost the same time as you, but you got to it first. The reason I didn’t delete my message was because it might actually help with a visual example.
As I said in my post, this will still error because the variable is a stored value and does not directly change the text transparency. Also, please do not duplicate responses. I already stated the .Value issue in my post above. No worries. Sometimes posts happen at the same time.
@TOP_Crundee123
I just tested your claim about FindFirstChild and it appears to be false. If you can DM me privately evidence of this case being true then I’ll make sure to clarify that here (just so we don’t clog up this post). However, it appears my test returns a nil print since the value doesn’t exist.
Variables. Remember texttrans1 and texttrans2 are not properties, they are variables. The reason why it never changes is that the variables change, but not the property.
Yes, that’s what I tested. I used dot syntax. Apologies if I misphrased that. Allow me to reiterate:
I tested the dot syntax using a single line of code and 3 instances to which the print statement outputted a nil value. Therefore, I can conclude your reasoning is false; however, no worries because it’s an easy fix.
I’m sure your suggestion might be the solution here, but can you give me a visual example of this? I am still quite an ametuer with Lua so I don’t necessarily know all the ins and out of FindFirstChild at the moment. I’ve tried implementing it already but it seems that I’m more confused by your suggestion that understanding of it. If you can reply with a picture example (or text, it doesn’t matter) I would appreciate it.
Sure thing! For FindFirstChild, the syntax would be like so:
Y = returned child (if it’s found)
X = object you want to find the child of
N = name of child you’re searching for
Y = X:FindFirstChild(N)
Also, make sure to NOT use variables to update the properties of something. You need to do that directly. For example:
guiObject.Property = whatIWant
Instead of:
local guiObjectProperty = guiObject.Property
guiObjectProperty = whatIWant
The bottom will not update the value since the variable acts as a “store” of sorts. It holds the updated value, but does not update the property of the object.
The way you’re trying to change the values is by saving the numerical value, and then changing an Integer. Instead, you should do
local text1 = script.Parent
local text2 = script.Parent.Parent.Name -- dont use Name here. See below.
text1.TextTransparency = .5
text2.TextTransparency = .5
Also, don’t have a TextLabel named as Name. When you try to call script.Parent.Parent.Name the script might instead get the String name of the Play TextButton.
You actually saved me tons of trouble with this issue. The code actually seemed to actually get the name property from the frame instead of going straight to the text label. I have no idea why I overlooked this so easily, but thank you so much!