Alright there is an Error on line 15 that says I need an end but I add an End and all it does is say the exact same thing.
Replicants = {"amegaman","papertiger67"} function Text(text,time,par,Texttype) local m=Instance.new(Texttype) m.Parent=par m.Text=text wait(time) if m~=nil then m:Destroy() end end game.Players.PlayerAdded:connect(function(plr) for i,v in pairs(Replicants)do if plr.Name:lower()==v:lower()then plr.Chatted:connect(function(msg) if msg:lower()=="@m" or msg:lower() == "@message" then Text("This is a message!",4,workspace,"Message") end elseif msg:lower():sub(1,9)=="@m/"or "@message/" then --'end' expected to close 'function' at line 15 near elseif Text(plr.Name..": "..msg:sub(4),4,workspace,"Message") end end) end end end)
Any help?
Tab your code properly.
It makes it easier to read and completely eliminates these errors.
Here is your code:
function Text(text,time,par,Texttype) local m=Instance.new(Texttype) m.Parent=par m.Text=text wait(time) if m~=nil then m:Destroy() end end game.Players.PlayerAdded:connect(function(plr) for i,v in pairs(Replicants)do if plr.Name:lower()==v:lower()then plr.Chatted:connect( function(msg) if msg:lower()=="@m" or msg:lower() == "@message" then Text("This is a message!",4,workspace,"Message") end -- REMOVE ME elseif msg:lower():sub(1,9)=="@m/"or "@message/" then Text(plr.Name..": "..msg:sub(4),4,workspace,"Message") end end ) end end end)
Notice yoru elseif
. It is not attached to any if
because the previous one was already end
ed.
Remove the end
immediately before it and it should work fine.