The team command have an error in output and I dont know how to sove it


local groupid = 8972210
local minrank = 100

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player:GetRankInGroup(groupid) >= minrank then
			player.Chatted:Connect(function(msg, recipient)
				if string.sub(msg, 1, 1) == ":" then
					print("False Command")
					local splitString = string.split(msg, " ")
					if splitString[1] == ":team" then
						print("Chnaging Team ".. splitString[2])
						game.Players:FindFirstChild(splitString[2])
						game.Teams:FindFirstChild(splitString[2](splitString[3])
							splitString[2].Team = game.Teams[splitString[3]]
						)
					end
				end
			end)
		end
	end)
end)

Try do this:


local groupid = 8972210
local minrank = 100

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player:GetRankInGroup(groupid) >= minrank then
			player.Chatted:Connect(function(msg, recipient)
				if string.sub(msg, 1, 1) == ":" then
					print("False Command")
					local splitString = string.split(msg, " ")
					if splitString[1] == ":team" then
						print("Chnaging Team ".. splitString[2])
						game.Players:FindFirstChild(splitString[2])
						game.Teams:FindFirstChild(splitString[2](splitString[3])
							(splitString[2].Team = game.Teams[splitString[3]]
					end
				end
			end)
		end
	end)
end)

1 Like

Did it work? (Sorry for the bump!)

I ahve the answer I will send you.

1 Like

We expect a public answer - Scripting Support - Cookie Tech (thecookie.dev) - We expect a public answer.

1 Like

Let me take it and post it.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player:GetRankInGroup(groupid) >= minrank then
			player.Chatted:Connect(function(msg, recipient)
				if string.sub(msg, 1, 1) == ":" then
					print("False Command")
				 local splitString = string.split(msg, " ")
					if splitString[1] == ":team" then
						print("Changing Team ".. splitString[2])
					end
					if game.Players:FindFirstChild(splitString[2]) then
						if game.Teams:FindFirstChild(splitString[3]) then
							game.Players:FindFirstChild(splitString[2]).Team = game.Teams:FindFirstChild(splitString[3])
						end
					end
				end
			end)
		end
	end)
end)

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