I’m trying to make a value change command and I can’t figure it out, here’s my current script:
local perms = {"Dubleey"}
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "StatFolder"
local race = Instance.new("StringValue", folder)
race.Name = "Race"
race.Value = "Human"
plr.CharacterAdded:Connect(function(char)
plr.Chatted:Connect(function(msg)
if table.find(perms, plr.Name) then
if string.match(msg, "set,[%w_]+,[%a]+,[%w]+") then
local playername = string.gsub(msg,"set,","")
playername = string.match(playername, "^[%w_]+")
local player = game.Players:FindFirstChild(playername)
local valuename = string.gsub(msg,",[%w]+$,","")
print(valuename)
valuename = string.match(valuename,"[%a]+$")
print(valuename)
local value = player.StatFolder:FindFirstChild(valuename)
print(value.Name)
local amountname = string.match(msg,"[%w]+$")
value.Value = amountname
end
end
end)
end)
end)
If you have anything to fix this do let me know.