1

# Script on stringvalues and leaderstats won't work?

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

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


0
PastDays 109
15 days ago

The script seems fine, A few questions:

Is this script run locally or on the server? Are the values changed from the client or the server?

0
The string values are stored in a folder in StarterGui and the LocalScript changing the the values is stored in each StringValue. Mystical_Un1verse 9 — 14d
0
And this script checking it is also local? If not then that would be why it's not working. PastDays 109 — 14d
0
It is a local script. Mystical_Un1verse 9 — 13d