|
| 30 Jul 2012 02:03 PM |
Okay, well, I fixed all the errors I could find, but my script still will not work, and I do not know where to fix it. The script doesn't say anything about the script. Please help me? I don't know where it errors! local mapChangers = {"IntelPhilosophy", "Jack705", "ExplicitBass"} local maps = {"Swords", "Guns", "Jeeps", "Tanks", "Hover", "RaidSim", "Orders", "Obby1", "Obby2", "Obby3", "ZombieVSVortex", "EndTrain", "CaptureTheFlag"} print 'Moo' function checkTable(t,n) for _,v in (t) do if n:lower() == v:lower() then return true end return false end end print 'Number eighteen!' function findMap(map) for _,v in pairs(maps) do if map:lower() == v:lower() then mp = game.Lighting:FindFirstChild(map) return mp end end end print 'Gotta problem with that?' function removeMaps(map) for _,v in pairs(maps) do for _,i in pairs(game.Workspace:GetChildren()) do if v == i.Name then i:Destroy() end end end end print 'NOOOO SCRIPT ERRORS HERE I THINK!' function onChat(msg, spk)
if msg:sub(1,6):lower() == "c/run/" and checkTable(mapChangers, spk.Name) then map = findMap(msg:sub(7)) if map then map:Clone().Parent = game.Workspace map:MakeJoints() map:MoveTo(Vector3.new(0,0,0)) removeMaps() end end end print 'Hayyyy girllll.' game.Players.PlayerAdded:connect(function(spk) spk.Chatted:connect(function(msg) onChatted(msg, spk) end) end) print 'End of script!' |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 02:04 PM |
| Add prints inside the functions and see what they say. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:06 PM |
| There are prints everywhere. You were already helping me debug this, but then I posted on the forum thread I was on at the time, and you did not respond. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 02:07 PM |
| The only prints are outside of the functions, and I didn't reply because I'm also working on my own thing atm. |
|
|
| Report Abuse |
|
|
| |
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 02:12 PM |
| You forgot pairs in the check table function. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 02:19 PM |
You also made a mistake when cloning in the new map. You cloned the new one and parented it, but then moved the original. I've rewritten the script and it should work:
local mapChangers = {"IntelPhilosophy", "Jack705", "ExplicitBass"}; local maps = {"Swords", "Guns", "Jeeps", "Tanks", "Hover", "RaidSim", "Orders", "Obby1", "Obby2", "Obby3", "ZombieVSVortex", "EndTrain", "CaptureTheFlag"};
print("Moo");
function checkTable(tbl, nm) for _, n in pairs(tbl) do if (n:lower() == nm:lower()) then return true; end end return; false end
print("Number eighteen!");
function findMap(map) if (checkTable(maps, map)) then return game.Lighting[map]; else return nil; end end
print("Gotta problem with that?");
function removeMap(map) for _, m in pairs(maps) do for _, p in pairs(workspace:GetChildren()) do if (m == p.Name) then p:Destroy(); end end end end
print("NOOOO SCRIPT ERRORS HERE I THINK!");
game.Players.ChildAdded:connect(function (plr) plr.Chatted:connect(function (msg) msg = msg:lower(); if ((msg:sub(1, 6) == "c/run/") and (checkTable(mapChangers, plr.Name)) then local map = findMap(msg:sub(7)); if (map) then local newMap = map:Clone(); newMap.Parent = workspace; newMap:MakeJoints(); newMap:MoveTo(Vector3.new(0, 0, 0)); removeMaps(); end end end); end);
print("End of script!"); |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 02:20 PM |
Doh, I messed up in checkTable:
function checkTable(tbl, nm) for _, n in pairs(tbl) do if (n:lower() == nm:lower()) then return true; end end return false; end |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:20 PM |
So... for _,v in pairs (t) do? |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
| |
|
| |
|
|
| 30 Jul 2012 03:18 PM |
| Does not work? Of course, I did change the c/run/ to "load/" if that makes any difference? |
|
|
| Report Abuse |
|
|