I’m upgrading my warns command by adding a billboard gui which displays this message:
“YOU HAVE BEEN WARNED FOR: (–Third argument of Argument Table–)”
However, im having a hard time splitting the table, and concentating it with the Text label’s text.
For more clarity:
Lets say I typed in:
J:Warn jeff Abusing Chat Commands
The Break String function would convert the sentence to:
jeff
Abusing
Chat
Commands
before storing these words in an array.
What i want to achieve to have the text label say is:
“You Have Been Warned For: Abusing Chat Commands”
I’m not sure how to split the string to only include a table with those 3 words, before converting that table into an string, which I could then concentate with my “You Have Been Warned For:” string.
The code I’m using:
elseif Command == "J:Warn" then
print("Warning...")
local Target = ArgsTable[2]
if string.lower(Target) == "all" then
for indexPlayer, Player in pairs(game.Players:GetPlayers()) do
if Player == plr then
print("Will not warn, as target is admin")
else
local Head = Player.Character:WaitForChild("Head")
if Head then
local WarningGuiClone = WarningBillboardGui:Clone()
WarningGuiClone.Text.Text = "You Have Been Warned For: "..string.split(table.concat(stringMsg, ArgsTable[3][2], " "))
WarnEvent:FireClient(Player, ArgsTable[3])
Player:WaitForChild("Warns").Value += 1
if Player:WaitForChild("Warns").Value == MainModule.MaxWarns then
Player:Kick("You Have Been Warned Too Many Times")
end
delay(10, function()
WarningGuiClone:Destroy()
end)
end
end
end
else
local Found_Player = MainModule.FindClosestMatchString("PlayerSearch", game.Players:GetPlayers(), Target)
if Found_Player ~= nil then
local Head = Found_Player.Character:WaitForChild("Head")
if Head then
local WarningGuiClone = WarningBillboardGui:Clone()
WarningGuiClone.Text.Text = "You Have Been Warned For: "..string.split(table.concat(stringMsg, ArgsTable[3][2], " "))
WarningGuiClone.Parent = Head
WarnEvent:FireClient(Found_Player)
Found_Player:WaitForChild("Warns").Value += 1
if Found_Player:WaitForChild("Warns").Value == MainModule.MaxWarns then
Found_Player:Kick("You Have Been Warned Too Many Times")
end
delay(10, function()
WarningGuiClone:Destroy()
end)
end
end
end
Sorry if this confuses you
P.S.
Error I’m currently getting:
20:30:13.322 - ServerScriptService.ChatHandler:135: invalid argument #1 to 'concat' (table expected, got string)