FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 28 Mar 2013 06:31 PM |
This is for the Advanced test. I am getting an error bar on the line 14 end.
allowed = {"FIRECAKE", "coolbob44"} function h(hit) hum = hit.Parent.findFirstChild("Humanoid") if hum ~= nil then local plyrname = hit.Parent.Name if plyrname == "allowed" then g = game.Workspace:GetChildren() for i = 1, #g do if g[i].ClassName == "Part" then g[i].CFrame = CFrame.fromEulerAnglesXYZ(0.9, 0.9, 0.9) m = Instance.new("Message") m.Text = plyrname.." broke this place!" end end else hit.Parent:BreakJoints then local a = game.Players:GetPlayerFromCharacter(hit.Parent) local b = Instance.new("Message") b.Text = "GO AWAY!" end end end
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 28 Mar 2013 06:31 PM |
also I realize there is no connection line
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 28 Mar 2013 06:39 PM |
Fixed the else line.
Now getting an error on the 16th line.
allowed = {"FIRECAKE", "coolbob44"} function h(hit) hum = hit.Parent.findFirstChild("Humanoid") if hum ~= nil then local plyrname = hit.Parent.Name if plyrname == "allowed" then g = game.Workspace:GetChildren() for i = 1, #g do if g[i].ClassName == "Part" then g[i].CFrame = CFrame.fromEulerAnglesXYZ(0.9, 0.9, 0.9) m = Instance.new("Message") m.Text = plyrname.." broke this place!" end end else hit.Parent:BreakJoints local a = game.Players:GetPlayerFromCharacter(hit.Parent) local b = Instance.new("Message") b.Text = "GO AWAY!" end end end script.Parent.hit:connect(h)
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 28 Mar 2013 06:43 PM |
1) It's "BreakJoints()" and not just "BreakJoints" 2) "if plyrname == "allowed" then" won't work, you need to use a loop to iterate through the array and then within that loop compare the iterated values against the player's name.
Fact: If you hover over the red lined text, it'll tell you the error. It also tells you the error of the first squiggly line in the bottom left. |
|
|
| Report Abuse |
|
|
kert109
|
  |
| Joined: 31 Dec 2009 |
| Total Posts: 681 |
|
|
| 28 Mar 2013 06:43 PM |
| Fix it urself bro. :o And u just reminded me.. I should probably become a higher rank right now in lua learners. |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 28 Mar 2013 06:49 PM |
I noticed the BreakJoints thing and facepalmed lol. And the plyrname == "allowed" thing was a longshot, I didn't know whether it would work or not...
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 28 Mar 2013 07:09 PM |
Attempt 2
function h(hit) hum = hit.Parent.findFirstChild("Humanoid") if hum ~= nil then p = game.Players:GetChildren() if p.Name == "FIRECAKE" or "coolbob44" then plyr = hit.Parent.Name g = game.Workspace:GetChildren() for i = 1, #g do if g[i].ClassName == "Part" then g[i].CFrame = CFrame.fromEulerAnglesXYZ(0.9, 0.9, 0.9) m = Instance.new("Message") m.Text = plyr.." broke this place!" end end else hit.Parent:BreakJoints() local a = game.Players:GetPlayerFromCharacter(hit.Parent) local b = Instance.new("Message") b.Text = "GO AWAY!" end end end script.Parent.hit:connect(h)
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 29 Mar 2013 10:28 AM |
Again, wouldn't work as you intended it.
Errors I can see: 1) It's ':FindFirstChild()' and not '.FindFirstChild()' 2) p doesn't have a name. Using ':GetChildren()' returns a table. 3) You've not set the parent of the instanced messages 4) You can't do an 'if statement' as you've done on line 5. 'if p.Name == "FIRECAKE" or p.Name == "coolbob44" then' 5) If you set the parent of the message inside the loop correctly, it would spam the screen with messages since it'll create a message for every part.
|
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 10:38 AM |
The only thing I am fairly confused about is the table that I'm returning with p.
Does that give me an array like {"FIRECAKE", "noob", "coolbob44", "Guest1337"}?
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 10:38 AM |
That's LuaLearners advanced?
I lol'd so hard. |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 29 Mar 2013 10:46 AM |
Using ':GetChildren()' on anything, will return the objects 'found' in a table.
|
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 11:06 AM |
script.Parent.Touched:connect(function() hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then p = game.Players:GetChildren() for i = 1, #children do if p[i] == "FIRECAKE" or p[i] == "coolbob44" then plyr = hit.Parent.Name g = game.Workspace:GetChildren() for i = 1, #g do if g[i].ClassName == "Part" then g[i].CFrame = CFrame.fromEulerAnglesXYZ(0.9, 0.9, 0.9) m = Instance.new("Message", game.Workspace) m.Text = plyr.." broke this place!" end end else hit.Parent:BreakJoints() local a = game.Players:GetPlayerFromCharacter(hit.Parent) local b = Instance.new("Message") b.Text = "GO AWAY!" end end end end)
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃
|
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 11:07 AM |
shoot, I meant to have #p
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 29 Mar 2013 11:21 AM |
local Broken = false script.Parent.Touched:connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) and not Broken then local Player = game.Players:GetPlayerFromCharacter(hit.Parent) if Player.Name == "FIRECAKE" or Player.Name == "coolbob44" then for _,v in pairs(Workspace:GetChildren()) do if v:IsA("BasePart") then v.CFrame = CFrame.fromEulerAnglesXYZ(0.9,0.9,0.9) end end Instance.new("Message", Workspace).Text = Player.Name.." has broken the server!" Broken = true else local Message = Instance.new("Message", Workspace) Message.Text = hit.Parent.Name.."... Thou shalt not screw this ones place so easily!" hit.Parent:BreakJoints() Broken = true Delay(3, function() Message:Destroy() Broken = false end) end end end)
And with yours... 1) Wouldn't of worked how you imagined it 2) 'hit' wasn't defined 3) No debounce 4) Your message for 'Go Away' wasn't parented, still. 5) What's "Children"? |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 11:54 AM |
I believe I have fixed it this time.
local debounce = false script.Parent.Touched:connect(function(hit) hum = script.Parent:GetChildren("Humanoid") if hum ~= nil and not debounce then local plyr = game.Players:GetPlayerFromCharacter(hit.Parent) if plyr.Name == "FIRECAKE" or Player.Name == "coolbob44" then parts = game.Workspace:GetChildren() for i = 1, #parts do if parts[i].ClassType == "Part" then parts[i].CFrame = CFrame.newFromEulerAnglesXYZ(0.9, 0.9, 0.9) msg = Instance.new("Message", game.Workspace) msg.Text = plyr.Name.." broke this place." debounce = true end end else local msg = Instance.new("Message") msg.Parent = plyr.PlayerGui msg.Text = "GO AWAY!" hit.Parent:BreakJoints() debounce = true end end end)
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃
|
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 11:54 AM |
line 6 fix
if plyr.Name == "FIRECAKE" or plyr.Name == "coolbob44" then
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 12:13 PM |
woot it runs!
local debounce = false script.Parent.Touched:connect(function(hit) hum = script.Parent:GetChildren("Humanoid") if hum ~= nil and debounce == false then local plyr = game.Players:GetPlayerFromCharacter(hit.Parent) if plyr.Name == "FIRECAKE" or plyr.Name == "coolbob44" then parts = game.Workspace:GetChildren() for i = 1, #parts do if parts[i].ClassType == "Part" then parts[i].CFrame = CFrame.newFromEulerAnglesXYZ(0.9, 0.9, 0.9) msg = Instance.new("Message", game.Workspace) msg.Text = plyr.Name.." broke this place." debounce = true end end else local msg = Instance.new("Message") msg.Parent = plyr.PlayerGui msg.Text = "GO AWAY!" hit.Parent:BreakJoints() debounce = true Delay(3, function() msg:Destroy() debounce = false end) end end end)
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃
|
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 12:15 PM |
aaaaaaaaaaaaand nevermind
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 12:29 PM |
hum = script.Parent:GetChildren("Humanoid")
Should be:
hum = hit.Parent:FindFirstChild("Humanoid")
(╯°□°)> KMXD
|
|
|
| Report Abuse |
|
|
btft
|
  |
| Joined: 19 Feb 2011 |
| Total Posts: 1512 |
|
| |
|
|
| 29 Mar 2013 12:35 PM |
Also, there is not ClassType property, you either want ClassName, or to use the IsA() method.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 29 Mar 2013 12:42 PM |
Oh, right, ClassName is what I was looking for.
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 12:47 PM |
@thedestroyer Yeah, it took me just a week or so to become a teacher. Way too easy.
MUST. RUIN. CHILDHOOD. |
|
|
| Report Abuse |
|
|
Thaeh
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
|
| 29 Mar 2013 01:11 PM |
| Advanced? This is probably a quarter of the first script I've made |
|
|
| Report Abuse |
|
|