Admin commands not working

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.

1 Like

Nevermind, I fixed it. I just did some more research and figure out a way.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.