Unication
|
  |
| Joined: 29 Mar 2013 |
| Total Posts: 5897 |
|
|
| 08 Dec 2013 02:11 AM |
-- -- -- Sample:
while true do wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlow1:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlow2:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlow3:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlow4:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlow5:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlow6:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() wait(0.1) if (script.Parent.Parent.className == "Model") then local clone = script.Parent.PartBladeWedgeGlowSpecial:clone() --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor local p = clone:getChildren() for i = 1, # p do if (p[i].className == "Sound") then p[i]:remove() end end end end end end end end end end end end end end end end end end end end end end
-- Any solutions?
http://www.youtube.com/watch?v=hod0WtYE4SA <-- What's really good!?!?!? |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Dec 2013 02:16 AM |
end end end end end end end end end end end Modify to your liking. |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Dec 2013 02:18 AM |
I know what would be a real eye candy:
end end end end end end end end end end end end end end end end end end end end end |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:18 AM |
Wait, Why do you keep checking if it`s a model? Dis script is inefficient and tedious to write. |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:19 AM |
@lampwnage121
Pssst... they are all the same... |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:21 AM |
Ye, I noticed. All but this line: "local clone = script.Parent.PartBladeWedgeGlow6:clone()" Didn`t really bother checking to confirm though. |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:21 AM |
Well I know one way you can avoid all this:
for |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:25 AM |
Yeh for i = 1,6 do clone = script.Parent["PartBladeWedgeGlow" .. i]:Clone() --rest of chunk end |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:26 AM |
| My head is going to collapse from the transition of AS3 to Lua. |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 02:49 AM |
| Ends are awesome why would you wanna remove them? |
|
|
| Report Abuse |
|
|
Unication
|
  |
| Joined: 29 Mar 2013 |
| Total Posts: 5897 |
|
|
| 08 Dec 2013 03:33 AM |
I don't want to remove 'em, I just need to find a way to make these End commands become compacted or shortened.
http://www.youtube.com/watch?v=hod0WtYE4SA <-- What's really good!?!?!? |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 03:50 AM |
for i = 1, 7 do if script.Parent.Parent.className == "Model" then if i ~= 7 then local clone = script.Parent:FindFirstChild("PartBladeWedgeGlow"..tostring(i)):clone() elseif i == 7 then local clone = script.Parent:FindFirstChild("PartBladeWedgeGlowSpecial"):clone() end --clone.Mesh:remove() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor for _, child in pairs(clone:GetChildren()) if child.className == "Sound" then child:Destroy() end end end
This is a bit messy layout wise, but you can fix that. It can be made even neater if you want by creating functions. For example: DestroySounds(child) -- The for loop to destroy the sounds CustomiseClone(clone) -- clone.Parent, clone.Anchored etc.
If you did that it would look like this
for i = 1, 7 do if script.Parent.Parent.className == "Model" then
if i ~= 7 then local clone = script.Parent:FindFirstChild("PartBladeWedgeGlow"..tostring(i)):clone() elseif i == 7 then local clone = script.Parent:FindFirstChild("PartBladeWedgeGlowSpecial"):clone() end
CustomiseClone(clone) DestroySounds(clone) end end end
--I haven't tested any of this. :/ |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 03:52 AM |
| Oops, remove the last end on the bottom script. |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 03:54 AM |
| I also forgot the 'do' in the for loop on the top script. |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 04:03 AM |
for i = 1, 7 do if script.Parent.Parent:IsA("Model") then
if i ~= 7 then local clone = script.Parent:FindFirstChild("PartBladeWedgeGlow"..tostring(i)):clone() elseif i == 7 then local clone = script.Parent:FindFirstChild("PartBladeWedgeGlowSpecial"):clone() end
CustomiseClone(clone) DestroySounds(clone) end end
function CustomiseClone(c) do --c.Mesh:Destroy() clone.Parent = script.Parent.Parent clone.Anchored = true clone.CanCollide = false clone.BrickColor = script.Parent.Parent.Torso.BrickColor end
function DestroySounds(c) do for _, child in pairs(c:GetChildren()) do if child:IsA("Sound") then child:Destroy() end end end
|
|
|
| Report Abuse |
|
|
|
| 08 Dec 2013 04:08 AM |
| Indent your code and all your problems will disappear. |
|
|
| Report Abuse |
|
|