generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Script needs debuging? Please help!

Previous Thread :: Next Thread 
IntelPhilosophy is not online. IntelPhilosophy
Joined: 05 Jun 2012
Total Posts: 285
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 is not online. 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
IntelPhilosophy is not online. IntelPhilosophy
Joined: 05 Jun 2012
Total Posts: 285
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 is not online. 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
IntelPhilosophy is not online. IntelPhilosophy
Joined: 05 Jun 2012
Total Posts: 285
30 Jul 2012 02:10 PM
Still nothing. :P
Report Abuse
Dr01d3k4 is not online. 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 is not online. 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 is not online. 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
IntelPhilosophy is not online. IntelPhilosophy
Joined: 05 Jun 2012
Total Posts: 285
30 Jul 2012 02:20 PM
So...
for _,v in pairs (t) do?
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 02:24 PM
Yeah, or try mine.
Report Abuse
IntelPhilosophy is not online. IntelPhilosophy
Joined: 05 Jun 2012
Total Posts: 285
30 Jul 2012 03:14 PM
Trying it now.
Report Abuse
IntelPhilosophy is not online. IntelPhilosophy
Joined: 05 Jun 2012
Total Posts: 285
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image