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)

8 comments
I'm confused, is this script located on the client or the server?
client
Can you explain what each script does and the difference between them (or if they are the same), and also what exactly this is for.
I don't quite understand what you mean by the first part of your question, but the script here is meant to take the Value from the IntValue called "Element". I made another script to of course make the IntValue and the Value of it is from 1-6. If the value equals one of those numbers, a certain script gets enabled. Example: If it equals 1, the script titled Element1 which is in PlayerGui gets
enabled.
Are all the element scripts the same?
Almost
The only thing that changes is the thing they set off