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

How do i make an imagelabel transparent when a IntValue is 1?

Asked by 5 years ago
Edited 5 years ago
    while true do wait(1)

if script.Parent.Parent.Parent.Workspace.raimbowfairyegg.Value.Value == 1 then

script.Parent.ImageLabel.Visible = true

end

end
0
Transparent is when visible = false or you set transparency to 1. ady1111 8 — 5y

2 answers

Log in to vote
0
Answered by
Despayr 505 Moderation Voter
5 years ago

You want to listen to any changes made to your Value. To do this, we use the Changed function.

Also, use Variables to make things look cleaner and easier.

  repeat wait(0.05) until game.IsLoaded() == true

  local Egg = workspace:WaitForChild("raimbowfairyegg")
  local Val = Egg:WaitForChild("Value")
  local Label = script.Parent:WaitForChild("ImageLabel")

  Val:GetPropertyChangedSignal("Value"):Connect(function()
       if Val.Value == 1 then
           Label.Visible = true
       else
           Label.Visible = false
       end
  end)
Ad
Log in to vote
0
Answered by
Kymaraaa 116
5 years ago
script.Parent.Parent.Parent.Workspace.raimbowfairyegg.Value.Changed:connect(function(Value)
    if Value == 1 then
        script.Parent.ImageLabel.Visible =  true
    else
        script.Parent.ImageLabel.Visible =  false
    end
end)

Answer this question