What I need is help getting the end of a string, in my script when a player uses a pattern in the chat it shows the player's name and the message after the pattern, the problem is that it only shows the name and not the pattern after the sequence. Here is the script I am using:
local admins={"ultrabug", "FredeyFly"}
game.Players.PlayerAdded:connect(function(np)
for i,v in pairs(admins) do
if np.Name==v then
np.Chatted:connect(function(msg)
if string.sub(msg, 1, 2)=="m/"then
cmt=np.Name..": "string.sub(msg, 3)
cm(cmt)
elseif string.sub(msg, 1, 5)=="kill/"then
plr=game.Players:findFirstChild(string.lower(string.sub(msg, 6)))
if plr ~=nil then
Kill(plr)
end
end
end)
end
end
end)
function cm(text)
local label=Instance.new("TextLabel")
local sg=Instance.new("ScreenGui")
for a,b in pairs(game.Players:GetChildren())do
plabel=label:Clone()
psg=sg:Clone()
psg.Parent=b.PlayerGui
plabel.Parent=psg
plabel.Size=UDim2.new(1, 0, 1, 0)
plabel.Text=text
plabel.BackgroundColor3=Color3.new(0, 0, 0)
plabel.BorderColor3=Color3.new(255, 0, 0)
plabel.TextColor3=Color3.new(255, 0, 0)
plabel.TextScaled=true
plabel.BackgroundTransparency=0.5
wait(6)
psg:Destroy()
end
label:Destroy()
sg:Destroy()
end
function Kill(player)
player.Character.Humanoid.Health=0
end
