generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: What shortcuts can you use to exclude mass "End" lines.

Previous Thread :: Next Thread 
Unication is not online. 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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
08 Dec 2013 02:12 AM
Deal with it?
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
08 Dec 2013 02:16 AM
end end end end end end end end end end end
Modify to your liking.
Report Abuse
KiwiMeister is not online. KiwiMeister
Joined: 18 Feb 2010
Total Posts: 1464
08 Dec 2013 02:17 AM
ElseIf?
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
08 Dec 2013 02:19 AM
@lampwnage121

Pssst... they are all the same...
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
08 Dec 2013 02:21 AM
Well I know one way you can avoid all this:

for
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
08 Dec 2013 02:25 AM
Yeh
for i = 1,6 do
clone = script.Parent["PartBladeWedgeGlow" .. i]:Clone()
--rest of chunk
end
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
08 Dec 2013 02:26 AM
My head is going to collapse from the transition of AS3 to Lua.
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
08 Dec 2013 02:49 AM
Ends are awesome why would you wanna remove them?
Report Abuse
Unication is not online. 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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
08 Dec 2013 03:52 AM
Oops, remove the last end on the bottom script.
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
08 Dec 2013 03:54 AM
I also forgot the 'do' in the for loop on the top script.
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 Dec 2013 04:08 AM
Indent your code and all your problems will disappear.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image