miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 04:27 PM |
-___- For some reason in my life I NEVER studied tables.Which is weird because tables are like the most important thing in lua.I've learned lots of other things.Anonyomous functions, loops,statements,instances, I can go on but I'm changing the subject. Anyway, Im gonna make a VIP with tables AND PLEASE DON'T FIX THE SCRITP!Just please tell me whats wrong so I can fix it myself.Thanks, here it is
local Table = {"miz656","DivinePheonix","Zarcius","SDuke524"} if Table[1] = miz656; Table[2] = DivinePheonix; Table[3] = Zarcius; Table[4] = SDuke524 then game.Workspace.Part.Touched:connect(function() game.Workspace.Part.CanCollide = false game.Workspace.Part.Transparency = .5 else game.Workspace.Part.Transparency = 1 game.Workspace.Part.CanCollide = true end end)
Once again, just please tell me what line is wrong and I'll try to fix it.DON'T FIX IT FOR ME!Tables are really important and for some reason I never really studied them.
|
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 04:29 PM |
"if Table[1] = miz656; Table[2] = DivinePheonix; Table[3] = Zarcius; Table[4] = SDuke524 then"
That's the part that's wrong. If you don't know what's wrong, then tables isn't the only thing you missed. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 04:35 PM |
Wait, is this it?(Since its a if then statement)
if Table[1] == miz656; Table[2] == DivinePheonix; Table[3] == Zarcius; Table[4] == SDuke524 then |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
|
| 30 Aug 2011 04:46 PM |
| Crazypotato is right, Go study back your conditions statements. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 04:48 PM |
I got thisfrom wiki
local myArray = {"A string", 3.14159, workspace.Part} print(myArray[1]) -- prints: A string print(myArray[2]) -- prints: 3.14159 print(myArray[3]:GetFullName()) -- prints: Workspace.Part
:P That's pretty much the same thing I did exept I forgot saying
:GetFullName())
Is taht what I did wrong? |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 04:53 PM |
No.Look
Original
if Table[1] = miz656; Table[2] = DivinePheonix; Table[3] = Zarcius; Table[4] = SDuke524 then
Fixed
if Table[1] = "miz656" and Table[2] = "DivinePheonix" and Table[3] = "Zarcius" and Table[4] = "SDuke524" then
You have to add and if you want if something = something and something = .
Keywords of conditions statements = if/then/elseif/and/or |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 04:54 PM |
| And add "" for you'r strings. |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 04:55 PM |
Miz, you don't know tables but you're taking students from OzzyPig's scripting helpers group?
Dude, you seriously need to brush up on your Lua. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 05:32 PM |
@trappingnoobs
Dude, my friend said they werent important and another person sais they were :PSo I didn't know which one to pick. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 05:33 PM |
And@sonic
Is that all I did wrong? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Aug 2011 05:34 PM |
| You're comparing strings to variables that you haven't set yet. ._. |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Aug 2011 05:36 PM |
You also didn't structure that right...
if [Conditon] do
function()
else -- This has no if statement that it could ever run with, it's INSIDE another function that would only run if it was false.
end -- End function
end -- End if |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 05:37 PM |
| Also, why not use a generic for loop? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 05:47 PM |
Nvm, I figured it out :D
Ps @Eletric I didn't use a generic loop because Im studying that next :o.I first promised to myself do tables since I never did them.Then generic loop. |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 05:58 PM |
Well, when you learn tables, it's best to learn generic for loops (as they're the best way to loop through a table).
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Aug 2011 08:06 PM |
| That why I learn tables FIRST then generic loop. |
|
|
| Report Abuse |
|
|