|
| 23 Apr 2013 04:16 AM |
Please note I am a beginner to Lua... I am working on a holo script, it's finished but it doesn't work.
a=game.lighting.obby b=game.lighting.SFT c=game.lighting.GFT d=game.workspace e=game.lighting
admin = {"10Andrea01"} admin2 = {"Redresistance97"} admin3 = {"coolkidthatrocks98"} admin4 = {"dpearce"} admin5 = {"Wreckerbuster67"} admin6 = {"raidcommander1"} admin7 = {"XxTheExtremexX"} admin8 = {"Ballboy0000"} admin9 = {"mosoman"} admin10 = {"Arxverse"} admin11 = {"hugthefatman1"} admin12 = {"hoho342"} admin13 = {"trycoldman23"}
function check(name) for a = 1, #admin do if admin[a] == name then return true end end return false end
function check2(name) for b = 1, #admin2 do if admin2[b] == name then return true end end return false end
function check3(name) for c = 1, #admin3 do if admin3[c] == name then return true end end return false end
function check4(name) for d = 1, #admin4 do if admin4[d] == name then return true end end return false end
function check5(name) for e = 1, #admin5 do if admin5[e] == name then return true end end return false end
function check6(name) for f = 1, #admin6 do if admin6[f] == name then return true end end return false end
function check7(name) for g = 1, #admin7 do if admin7[g] == name then return true end end return false end
function check8(name) for h = 1, #admin8 do if admin8[h] == name then return true end end return false end
function check9(name) for i = 1, #admin9 do if admin9[i] == name then return true end end return false end
function check10(name) for j = 1, #admin10 do if admin10[j] == name then return true end end return false end function check11(name) for k = 1, #admin11 do if admin11[k] == name then return true end end return false end
function check12(name) for l = 1, #admin12 do if admin12[l] == name then return true end end return false end
function check13(name) for m = 1, #admin13 do if admin13[m] == name then return true end end return false end
function onChat(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load Obstacles" then check() check2() check3() a.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load SFT" then check() check2() check3() b.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load GFT" then check() check2() check3() c.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End Obstacles" then check() check2() check3() a.parent=e end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End SFT" then check() check2() check3() b.parent=e end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End GFT" then check() check2() check3() c.parent=e end
game.Players.ChildAdded:connect(function(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChat(msg, recipient, newPlayer) end) end)
Sorry for not tabbing. Anyways, I know my mistake is somewhere near functions..... Please tell me what to do. |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 23 Apr 2013 04:53 AM |
This is way more efficient.
Admins = {"FirstName", "SecondName"}
function AdminCheck(Player) for i = 1,#Admins do if Player.Name == Admins[i] then return true end end return false end
Game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end)
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 05:05 AM |
| Thanks a lot, I'll just improvise. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 06:27 AM |
Didn't work. Here's what I came up with your suggestion:
a=game.lighting.obby b=game.lighting.SFT c=game.lighting.GFT d=game.workspace e=game.lighting
Admins = {"10Adnrea01","Redresistance97","coolkidthatrocks98","dpearce","Wreckerbuster67", "raidcommander1","XxTheExtremexX","Arxverse","mosoman","Ballboy000","cute34347441", "hugthefatman1","trycoldman23","hoho342"}
function AdminCheck(Player) for i = 1,#Admins do if Player.Name == Admins[i] then return true end end return false end
function onChat(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load Obstacles" then check() check2() check3() a.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load SFT" then check() check2() check3() b.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load GFT" then check() check2() check3() c.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End Obstacles" then check() check2() check3() a.parent=e end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End SFT" then check() check2() check3() b.parent=e end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End GFT" then check() check2() check3() c.parent=e end
Game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end) |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 23 Apr 2013 06:32 AM |
A few questions:
- What are the functions check(), check2() and check3() containing? Where are they defined?
- Why do you use "local source = ..." for every command, thus making it a waste? :>
- Are you trying to put the WORKSPACE into the LIGHTING?! What? (Lowercase workspace?)
Try use elseif :P Yeah, and you can use loops to make it more flexible.
- As, my ziggy just dropped here. Say hello. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 06:35 AM |
| As I said I'm a beginner. Also, I have my methods. And what do you mean Workspace into Lighting? If you read the variables, I am switching models' parents from Workspace to Lighting. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 07:55 AM |
Having that glitch where I can't see new posts if I don't post.
Anyways, I took As8's advice, came up with this:
a=game.lighting.obby b=game.lighting.SFT c=game.lighting.GFT d=game.workspace e=game.lighting
Admins = {"10Adnrea01","Redresistance97","coolkidthatrocks98","dpearce","Wreckerbuster67", "raidcommander1","XxTheExtremexX","Arxverse","mosoman","Ballboy000","cute34347441", "hugthefatman1","trycoldman23","hoho342"}
function AdminCheck(Player) for i = 1,#Admins do if Player.Name == Admins[i] then return true end end return false end
function onChat(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load Obstacles" then check() check2() check3() a.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load SFT" then check() check2() check3() b.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load GFT" then check() check2() check3() c.parent=d end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End Obstacles" then check() check2() check3() a.parent=e end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End SFT" then check() check2() check3() b.parent=e end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer End GFT" then check() check2() check3() c.parent=e end
Game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end) |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 07:56 AM |
Woops wrong version.
a=game.lighting.obby b=game.Lighting.SFT c=game.Lighting.GFT d=game.Workspace e=game.Lighting
Admins = {"10Adnrea01","Redresistance97","coolkidthatrocks98","dpearce","Wreckerbuster67", "raidcommander1","XxTheExtremexX","Arxverse","mosoman","Ballboy000","cute34347441", "hugthefatman1","trycoldman23","hoho342"}
function AdminCheck(Player) for i = 1,#Admins do if Player.Name == Admins[i] then return true end end return false end
function onChat(msg, recipient, speaker) end
local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "Computer Load Obstacles" then a.Parent=d elseif msg == "Computer Load SFT" then b.Parent=d elseif msg == "Computer Load GFT" then c.Parent=d elseif msg == "Computer End Obstacles" then a.Parent=e elseif msg == "Computer End SFT" then b.Parent=e elseif msg == "Computer End GFT" then c.Parent=e end
Game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end)
There you have the correct one. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 23 Apr 2013 08:17 AM |
Let's just correct everything at once shall we? ;)
a=game.lighting.obby b=game.Lighting.SFT c=game.Lighting.GFT d=game.Workspace e=game.Lighting
Admins = {"10Adnrea01","Redresistance97","coolkidthatrocks98","dpearce","Wreckerbuster67", "raidcommander1","XxTheExtremexX","Arxverse","mosoman","Ballboy000","cute34347441", "hugthefatman1","trycoldman23","hoho342"}
function AdminCheck(Player) for i = 1,#Admins do if Player.Name == Admins[i] then return true end end return false end
function CommandTrigger(msg,speaker) local source = string.lower(speaker) msg = string.lower(msg) if msg == string.lower("Computer Load Obstacles") then a.Parent=d elseif msg == string.lower("Computer Load SFT") then b.Parent=d elseif msg == string.lower("Computer Load GFT") then c.Parent=d elseif msg == string.lower("Computer End Obstacles") then a.Parent=e elseif msg == string.lower("Computer End SFT") then b.Parent=e elseif msg == string.lower("Computer End GFT") then c.Parent=e end
Game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end)
I hope this helps and works... Enjoy :)
~sycips~ |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2013 05:59 AM |
Didn't work, sycips. Also, I added in more variables in one attempt.
a=game.lighting.obby b=game.Lighting.SFT c=game.Lighting.GFT d=game.Lighting.ShootingRange z=game.Workspace y=game.Lighting
Admins = {"10Adnrea01","Redresistance97","coolkidthatrocks98","dpearce","Wreckerbuster67", "raidcommander1","XxTheExtremexX","Arxverse","mosoman","Ballboy000","cute34347441", "hugthefatman1","trycoldman23","hoho342"}
function AdminCheck(Player) for i = 1,#Admins do if Player.Name == Admins[i] then return true end end return false end
function CommandTrigger(msg,speaker) local source = string.lower(speaker) msg = string.lower(msg) if msg == string.lower("Computer Load Obstacles") then a.Parent=z elseif msg == string.lower("Computer Load SFT") then b.Parent=z elseif msg == string.lower("Computer Load GFT") then c.Parent=z elseif msg == string.lower("Computer Load Target Practice") then d.Parent=z elseif msg == string.lower("Computer End Obstacles") then a.Parent=y elseif msg == string.lower("Computer End SFT") then b.Parent=y elseif msg == string.lower("Computer End GFT") then c.Parent=y elseif msg == string.lower("Computer End Target Practice") then d.Parent=y end
Game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end)
For some reason, when I script manually in game using admin, it works. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 24 Apr 2013 10:06 AM |
| do you get an error message? else nobody can help you... |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 24 Apr 2013 10:11 AM |
^ I... AM... NOBODY! And many other characters you find in a thrown-away catalog of super heroes from the ancient Rome.
- As, zapzap, lazyman. |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2013 11:49 PM |
| @Sycips: It says end is expected to close the Function CommandTrigger. |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2013 11:52 PM |
| I think I found my mistake, I forgot that scripts are Cap Sensitive. My first variable had game.lighting.obby instead of game.Lighting.Obby. Re-testing, I hope it works. |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2013 11:52 PM |
| Then add an 'end' at the end of that function |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2013 11:54 PM |
end is expected to close the Function CommandTrigger.
This means your missing an end. If your Variables were wrong, Output would say so.
Listen to cheat. |
|
|
| Report Abuse |
|
|
chris1989
|
  |
| Joined: 30 Nov 2007 |
| Total Posts: 2520 |
|
|
| 25 Apr 2013 01:25 AM |
a=game.lighting:WaitForChild("OBBY") b=game.Lighting:WaitForChild("SFT") c=game.Lighting:WaitForChild("GFT") d=game.Lighting:WaitForChild("ShootingRange") z=game.Workspace y=game.Lighting
Admins = {"10Adnrea01","Redresistance97","coolkidthatrocks98","dpearce","Wreckerbuster67", "raidcommander1","XxTheExtremexX","Arxverse","mosoman","Ballboy000","cute34347441", "hugthefatman1","trycoldman23","hoho342"}
function AdminCheck(Player) for i,v in pairs(Admins) do if Player.Name == v then return true end end return false end
function CommandTrigger(msg,speaker) local source = string.lower(speaker) if msg == string.lower("Computer Load Obstacles") then a.Parent=z elseif msg == string.lower("Computer Load SFT") then b.Parent=z elseif msg == string.lower("Computer Load GFT") then c.Parent=z elseif msg == string.lower("Computer Load Target Practice") then d.Parent=z elseif msg == string.lower("Computer End Obstacles") then a.Parent=y elseif msg == string.lower("Computer End SFT") then b.Parent=y elseif msg == string.lower("Computer End GFT") then c.Parent=y elseif msg == string.lower("Computer End Target Practice") then d.Parent=y end end
game.Players.PlayerAdded:connect(function(new) if AdminCheck(new) then new.Chatted:connect(function(Message) CommandTrigger(Message, new.Name) end) end end) |
|
|
| Report Abuse |
|
|
1eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 7074 |
|
|
| 25 Apr 2013 01:44 AM |
| Everyone here is forgetting to capitalize Lighting in the first line. |
|
|
| Report Abuse |
|
|
chris1989
|
  |
| Joined: 30 Nov 2007 |
| Total Posts: 2520 |
|
|
| 25 Apr 2013 01:46 AM |
Shoulda just did this.....
y=game.Lighting a=y:WaitForChild("OBBY") b=y:WaitForChild("SFT") c=y:WaitForChild("GFT") d=y:WaitForChild("ShootingRange") z=game.Workspace |
|
|
| Report Abuse |
|
|
1eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 7074 |
|
|
| 25 Apr 2013 01:48 AM |
| You might want to add pcalls to the lines where it is parenting the models to the Workspace and the Lighting. |
|
|
| Report Abuse |
|
|
chris1989
|
  |
| Joined: 30 Nov 2007 |
| Total Posts: 2520 |
|
|
| 25 Apr 2013 01:50 AM |
| What for? The models are never redefined so even if you parent one to workspace twice in a row it wont break. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2013 02:56 AM |
| None of your suggestions are working. Also, I changed the Models' names, but I also change the variables in the script. If you're wondering, I have the Models SwordFight, Obby, GunFight, ShootingRange in Lighting. |
|
|
| Report Abuse |
|
|
chris1989
|
  |
| Joined: 30 Nov 2007 |
| Total Posts: 2520 |
|
|
| 25 Apr 2013 03:00 AM |
| new.Chatted:connect(function(msg) CommandTrigger(msg, new.Name) end) |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 25 Apr 2013 03:54 AM |
---
Countdown started for implementing a hologram effect I made months ago and fixing your easy problem.
Cannot do it now ): School.
---
- As,neon-glowing hologram power source. |
|
|
| Report Abuse |
|
|