I have a script that when a leaderstat in a player is changed to a specific word, the value of the StringValue will change to the players name with the keyword. The problem is, there are two StringValues and they both have essentially the same script just with different keywords, and only one of them will work at a time so only one StringValue has a players name. I tried to make this explanation as least confusing as possible.
local namevalue = script.Parent
for i, plr in pairs(game.Players:GetPlayers()) do
local findvalue = plr.leaderstats:FindFirstChild("StringValue")
findvalue.Changed:Connect(function(NewValue)
if findvalue.Value == "Keyword" then
namevalue.Value = plr.Name
else if findvalue.Value ~= "Keyword" then
namevalue.Value = ""
end
end
end)
end

3 comments
The string values are stored in a folder in StarterGui and the LocalScript changing the the values is stored in each StringValue.
And this script checking it is also local? If not then that would be why it's not working.
It is a local script.