I've finally gotten a label system to work, however, I'm now encountering a new snag -- it's not wanting to change the text and colour. I've currently got this snippet of the script to examine:
local objname = mouse.Target.Parent.Name if objname == "Wall1" then local objtru = objname == "Wall1" gui3.Text.Text = "Mud Wall" gui3.Text.BackgroundColor3 = Color3.new(158, 158, 158) gui3.Text.Visible = objtru wait(.3) end
This isn't the full script of course, but it should be enough. This is all inside of a local script. The function holding this activates whenever the mouse moves. The line gui3.Text.Visible = objtru
activates perfectly fine, meaning that this code block in the if runs.
I see no reason why it won't change the text or the colour.
Thank you for reading, and I look forward to finding out why this is occurring!
There are a few problems with this that I can see.
The first is in the first line:
local objname = mouse.Target.Parent.Name
mouse.Target
can be nil
, when you are pointing at the sky. In that case, this would result in an error ("cannot index 'Parent' of 'nil'"), so we should first check that mouse.Target
is in fact not nil
.
Your use of objtru
is superfluous. It will always be true
since it is in the body of an if
ensuring that.
Probably you meant to move line 4 and line 7 outside of the if
statement.
You haven't defined gui3
in this script. Probably you forgot to define it or just didn't include it in this snippet.
The Color3.new
constructor actually uses values between 0 and 1, not 0 and 255 like shown in the Properties tab. Divide the numbers by 255 to get the appropriate conversion.