I’m trying to script a button so that its visibility state is only true when the leaderstats value is equal to 1 for example.
What is the issue?
I’ve tried to figure it out myself, but my knowledge on scripting isn’t the best! pointing me in the right direction would be really useful - keep in mind I don’t want you to tell me the answer directly.
What solutions have you tried so far?
There isn’t much in the way of this topic (that I have found) but I would be grateful if you could reply with links to other posts regarding this!
This is my current code in a local script under the button in question.
while wait () do
if game.Players.LocalPlayer.leaderstats.Stage.Value == 1 then
script.Parent.Visible = true else
script.Parent.Visible = false
end
game.Players.LocalPlayer.leaderstats.Stage:GetPropertyChangedSignal('Value'):Connect(function(NewValue)
if NewValue == 1 then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
end)
game.Players.LocalPlayer.leaderstats.Stage.Changed:Connect(function(value)
if value == 1 then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
end)
Actually it wouldn’t, .Changed is special for IntValues/BoolValues/StringValues/ObjectValues/NumberValues. It will only detect changes ln the .Value property