Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why doesn't this chat command work!?!?!

I have tried so much to figure this out. It. Just. Won't. Work. Please help!

game.Players.PlayerAdded:connect(function(p) local RN = p:GetRankInGroup(1065415) if RN > 5 then p.Chatted:connect(function(msg) if msg:sub(1,4) == ":DP " then local length = 5 repeat local cmsg = msg:lower():sub(length, length) length = length + 1 until cmsg == " " space = length plr = msg:lower():sub(5, space - 1) val = msg:lower():sub(space + 1) value = tonumber(val) game.Players:FindFirstChild(plr):FindFirstChild("D-POINTS").Value = value end end) end end)

By the way, I am only on this website, for this one question. Don't expect me to be on here a lot.

1 answer

game.Players.PlayerAdded:connect(function(p) 
	local RN = p:GetRankInGroup(1065415) 
	if RN > 5 then 
		p.Chatted:connect(function(msg) 
			if msg:sub(1,4) == ":DP " then 
				local length = 5 
				local cmsg = ""
				local lastchar = ""
				repeat 
					lastchar = msg:lower():sub(length, length) 
					cmsg = cmsg .. lastchar
					length = length + 1 
				until lastchar == " " 
				space = length 
				local plr = msg:sub(5, space - 1) 
				local val = msg:sub(space + 1) 
				local value = tonumber(val) 
				game.Players:FindFirstChild(plr):FindFirstChild("D-POINTS").Value = value 
			end 
		end) 
	end 
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.