When a TextGUI in "..." then a part is visible, else not

Hello,

This is what i am looking for.

  • If a TextGUI’s Text is “…” then a part will be visible, if the TextGUI’s text is something different, the part will be invisible
local TextGui = blablabla
local Part = blablabla

if TextGui.Text == "..." then 
	Part.Transparency = 0
else 
	Part.Transparency = 1
end

It only works on the Else, when i change the text to that it does not work, maybe i can send a video or screenshare?

Run the second half of that code every time the text changes.

(Without the Else)

You have to run it everytime the TextLabel changes instead of once, you do that by turning it into a function and running it once the .Changed event triggers:

local textLabel = ...
local part = ...

function UpdatePart()
if textLabel.Text == "..." then
part.Transparency = 0
else
part.Transparency = 1
end
end

textLabel.Changed:Connect(UpdatePart)

Please let me know any problems with the script

That shouldnt be a problem in this case, since the part is the thing that changes, not the text.

Thank you so much!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.