Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this script work?

So this is how it works. I have one of those "Text" signs and I want to make it so if the sign says "Life" it would change the transparency of a textbutton. For some reason this script is not working, can someone tell me how I can fix it?

x = game.Workspace.SignAins.Board.Face.Contents
y =  game.StarterGui.ScreenGui["A Account"].Life1


if x.Text == "Cat" then
y.BackgroundTransparency = 0.9 
end

1 answer

✓ Accepted answer

You're only checking the text once, right when the script loads. Try using an event.

x = game.Workspace.SignAins.Board.Face.Contents
y = game.StarterGui.ScreenGui["A Account"].Life1


x.Text.Changed:connect(function(val)
	if val == "Cat" then
		y.BackgroundTransparency = 0.9
	else:
		y.BackgroundTransparency = 0
	end
end)

This will check the text value of 'x' every time it's changed, and if it says Cat, it will set the BackgroundTransparency of 'y' to 0.9. Otherwise, it will set it to 0.

This discussion is preserved as it was. New answers, comments, and votes are closed.