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
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?