smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 14 Jul 2014 09:19 PM |
Right after it prints "2" the script won't run.
function onClicked()
print "1"
local g = game.Lighting.pbasic.Chest:clone() g.Parent = game.Players.LocalPlayer local C = g:GetChildren()
print "2"
for i=1, #C do if C[i].className == "Part" then local W = Instance.new("Weld") W.Part0 = g.Middle W.Part1 = C[i] local CJ = CFrame.new(g.Middle.CFrame) local C0 = g.Middle.CFrame:inverse()*CJ local C1 = C[i].CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = g.Middle
print "3"
end local Y = Instance.new("Weld") Y.Part0 = game.Players.LocalPlayer.Chest -- HM? This is real or mistake? Y.Part1 = g.Middle Y.C0 = CFrame.new(0, 0, 0) Y.Parent = Y.Part0-- Why is this end here?
print "4"
local h = g:GetChildren()
end
for a = 1, #h do if h[a].className == "Part" then h[a].Anchored = false h[a].CanCollide = false end end end
script.Parent.MouseButton1Click:connect(onClicked)
|
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:23 PM |
Right before/after print'2' put print(#C) |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:23 PM |
You're missing an end somewhere
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:26 PM |
Nop It wouldn't print anything besides "Error in script: end expected near"... |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 14 Jul 2014 09:29 PM |
| It doesn't do any more or less when i had the 'print (#C)' and I couldn't find a place that needed an 'end'. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:31 PM |
You're doing it wrong. If there is no output after 2 is printed, your for loop is looking like this "for i = 1,0 do" thus it'll never run. From this was can assume #C = 0 if you put the print(#C) where I told you it'd either print 0 which confirms my theory or it'd print another number. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:33 PM |
You're still missing an end
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:34 PM |
Disregard my previous comment, I forgot how to numbers
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 14 Jul 2014 09:34 PM |
| I missed the error since I was just looking for a number, anyways #C = 0 |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:36 PM |
That means that game.Lighting.pbasic.Chest has no descendants.
|
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 14 Jul 2014 09:58 PM |
I fixed that, but still stops at the same area.
function onClicked()
print "1"
local g = game.Lighting.pbasic.Chest:clone() g.Parent = game.Players.LocalPlayer local C = g.Parent:GetChildren()
print "2"
for i=1, #C do if C[i].className == "Part" then -- Should I remove this and/or the line above -- it? local W = Instance.new("Weld") W.Part0 = g.Middle W.Part1 = C[i] local CJ = CFrame.new(g.Middle.CFrame) local C0 = g.Middle.CFrame:inverse()*CJ local C1 = C[i].CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = g.Middle
print "3"
end local Y = Instance.new("Weld") Y.Part0 = game.Players.LocalPlayer.Torso -- HM? This is real or mistake? Y.Part1 = g.Middle Y.C0 = CFrame.new(0, 0, 0) Y.Parent = Y.Part0
print "4"
local h = g:GetChildren()
end
for a = 1, #h do if h[a].className == "Part" then h[a].Anchored = false h[a].CanCollide = false end end end
script.Parent.MouseButton1Click:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 10:13 PM |
| No output besides the prints? |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 14 Jul 2014 10:13 PM |
| for is a loop, not a function. |
|
|
| Report Abuse |
|
|
| |
|