Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this script work?

Asked by
Danfly 5
10 years ago

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

Log in to vote
0
Answered by
MrFlimsy 345 Moderation Voter
10 years ago

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.

Ad

Answer this question