Im trying to make a holo script, which im making very good progress with, but I cant figure out how to check how to see if a user called a certain map name...
Here is the script.
local admins ={"EmperorVolvax"} local gid = 1173040 local gidranks = {255,105,104,103,102,101} local maps = {"sft", "obby", "sft"} -- Map names --Dont Mess with the Below -- local mapsParent = maps.Parent == game.ServerStorage -- Not sure if this is needed or not.. function contains(list, element) for _, value in pairs(list) do if value == element then return true end end end game.Players.PlayerAdded:connect(function(Player) if contains(gidranks, Player:GetRankInGroup(gid)) then for _,v in pairs(admins) do Player.Chatted:connect(function(msg) if msg == "load"..maps then -- Trouble point end end) end end end)
Well, what you are trying to do there is add a table onto a string (which obviously wouldn't work).
A better way of doing it would be to use :sub(), which grabs a section of a string based on the arguments given.
For your example, do something like:
if msg:sub(0,4) == "load" then --if letters 0 to 4 are "load" then... local MapName = msg:sub(5) --Everything from letters 5+ end
You could also use the :lower() method to allow the player to use any case when saying it, so this would be a final code:
local admins ={"EmperorVolvax"} local gid = 1173040 local gidranks = {255,105,104,103,102,101} local maps = {"sft", "obby", "sft"} --Dont Mess with the Below -- function contains(list, element) for _, value in pairs(list) do if value == element then return true end end end game.Players.PlayerAdded:connect(function(Player) if contains(gidranks, Player:GetRankInGroup(gid)) then for _,v in pairs(admins) do Player.Chatted:connect(function(msg) if msg:lower():sub(0,4) == "load" then for i,Map in pairs(maps) do if Map:lower() == msg:lower():sub(5) then --ChosenMap = Map --PositionInTable = i end end end end) end end end)
If you still don't understand, try this wiki page:
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation#string.sub