I have a training place and I want to have it where I can have people put in different groups by a command. When I try to do this I am getting an error saying:
“ServerScriptService:147:attempt to perform arithmetic (add) on string”
Script
local GroupId = 5952287 --GroupId
local MinimumRankToUseCommand = 249 --Rank to use this command
function Check(name)
name = name:lower()
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name:lower():sub(1,#name) == name then
return v
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
Player.Chatted:Connect(function(Message)
local Words = string.split(Message, " ")
if Words[1] == ":Group" then
local NameOfPlayerToGiveGroup = Words[2]
local GroupToGive = Words[3]
local PlayerToGiveGroup = Check(NameOfPlayerToGiveGroup)
if PlayerToGiveGroup then
PlayerToGiveGroup.leaderstats.Group.Value = PlayerToGiveGroup.leaderstats.Group.Value + GroupToGive
end
end
end)
end
end)
Could anyone help me with this? Tell me if you need anymore information.