My announcement system isn't separating words

I made an announcement/countdown system for a rank in a group. The countdown works fine but when I try to use the announcement it won’t space the words out. If I do more than one word it will only show the first word. Any help is nice!

local prefix = "!"
local groupid = 12977816
local CountdownCommand = "countdown"
local AnnouncementCommand = "announcement"
local LowestRank = 3
-------------------------------------

game.Players.PlayerAdded:Connect(function(plr)
	if plr:GetRankInGroup(groupid) >= LowestRank then
		plr.Chatted:Connect(function(c)
			local l = string.lower(c)
			local s = string.split(l," ")
			local cmd = s[1]
			local val = s[2]
			local plrname = plr.Name
			local id = plr.UserId
			if cmd == prefix..CountdownCommand then
				game.ReplicatedStorage.Countdown:FireAllClients(plrname, val, id, groupid, LowestRank)
			else
				if cmd == prefix..AnnouncementCommand then
					game.ReplicatedStorage.Announcement:FireAllClients(plrname, val, id, groupid, LowestRank)
				end
			end
		end)
	end
end)


I know this might seem complicated but i didnt think of any other way of doing it

local prefix = "!"
local groupid = 12977816
local CountdownCommand = "countdown"
local AnnouncementCommand = "announcement"
local LowestRank = 3
-------------------------------------

game.Players.PlayerAdded:Connect(function(plr)
	if plr:GetRankInGroup(groupid) >= LowestRank then
		plr.Chatted:Connect(function(c)
			local plrname = plr.Name 
			local id = plr.UserId
			
			if string.sub(c, 1, (string.len(CountdownCommand) + string.len(prefix))) == prefix..CountdownCommand then
				local val = string.sub(c, (string.len(CountdownCommand) + string.len(prefix) + 2), string.len(c) )
				game.ReplicatedStorage.Countdown:FireAllClients(plrname, val, id, groupid, LowestRank)
			elseif string.sub(c, 1, (string.len(AnnouncementCommand) + string.len(prefix))) == prefix..AnnouncementCommand then
				local val = string.sub(c, (string.len(AnnouncementCommand) + string.len(prefix) + 2), string.len(c) )
				game.ReplicatedStorage.Announcement:FireAllClients(plrname, val, id, groupid, LowestRank)
			end
		end)
	end
end)


Maybe. I will try it out but I feel like its a tiny mistake I made or something.

Ohhh okay I see what you did know! Thanks for the help it worked by the way! For right now I will use that but I feel like I missed a tiny something in my script to make it work simpler.

1 Like

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