Trouble with causing something to happen when value changes? [SOLVED]
Asked by
6 years ago Edited 6 years ago
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)
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | repeat wait() until player.Character |
04 | local element = script.Parent.Parent.lstats.Element |
06 | element.Changed:Connect( function () |
07 | if element.Value = = 1 then |
08 | player.PlayerGui.Element.Disabled = false |
10 | if element.Value = = 2 then |
11 | player.PlayerGui.Element 2. Disabled = false |
13 | if element.Value = = 3 then |
14 | player.PlayerGui.Element 3. Disabled = false |
16 | if element.Value = = 4 then |
17 | player.PlayerGui.Element 4. Disabled = false |
19 | if element.Value = = 5 then |
20 | player.PlayerGui.Element 5. Disabled = false |
22 | if element.Value = = 6 then |
23 | player.PlayerGui.Element 6. Disabled = false |