So, I'm trying to make it so that when the value of this IntValue changes, a script becomes enabled. When the value changes, the script is still disabled. I can't seem to figure out the problem and want to see if anyone can find a solution. (lstats is leaderstats, but I just changed the name)
game.Players.PlayerAdded:Connect(function(player) repeat wait() until player.Character local element = script.Parent.Parent.lstats.Element element.Changed:Connect(function() if element.Value == 1 then player.PlayerGui.Element.Disabled = false end if element.Value == 2 then player.PlayerGui.Element2.Disabled = false end if element.Value == 3 then player.PlayerGui.Element3.Disabled = false end if element.Value == 4 then player.PlayerGui.Element4.Disabled = false end if element.Value == 5 then player.PlayerGui.Element5.Disabled = false end if element.Value == 6 then player.PlayerGui.Element6.Disabled = false end end)
I fixed the issue myself. I first changed this over to a server script and then there was also an issue with my other script that made the value. It set it automatically as a number 1 through 6, but I was using the Changed event. To fix this, in my other script, I put a wait(1) and then changed the value. (the wait isn't necessary though.)