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 » Scripters
Home Search
 

Re: Loop issues.

Previous Thread :: Next Thread 
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 03:30 PM
Okay, so I'm trying to edit every body part of the player at once, but the thing is, whenever I use a loop, it edits all the parts one by one, and I don't exactly want to do it one by one myself.

-- this is a local script.
function onClicked(Clicked)
local Player = game.Players.LocalPlayer.Character;
if Player then
local Smoke = Instance.new("Smoke");
Smoke.Color, Smoke.Opacity = Color3.new(0, 0, 0), 0.5;
local Parts = Player:GetChildren()
for _,Part in pairs(Parts) do
if Part:IsA("Part") and Part.Name ~= "HumanoidRootPart" then
for i = 1, 10 do
Part.Transparency = Part.Transparency + 0.1
wait(0.1)
end
end
end
end
end
script.Parent.MouseButton1Click:connect(onClicked);


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 03:34 PM
Hmm, anyone?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 03:38 PM
Also, please do excuse the ;'s, I have placed in here.
It's a habit.


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
18 Sep 2015 03:41 PM
Separate each process into different threads or modify all of the parts at the same time.


[As edgy as a rhombicosidodecahedron]
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 05:05 PM
Separate each process?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
18 Sep 2015 05:09 PM
Player.Character not Player.
Report Abuse
boo871 is not online. boo871
Joined: 18 Jan 2014
Total Posts: 142
18 Sep 2015 05:12 PM
spawn(function() end) ignores time

replace the lines you have with this:

spawn(function()
for i = 1, 10 do
Part.Transparency = Part.Transparency + 0.1
wait(0.1)
end)
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 05:12 PM
Uhm.
Help?
I think I did it wrong.

local Player = game.Players.LocalPlayer.Character
function InvisiblePlayer()
if Player then
local function Convert()
for _,Limb in pairs(Player:GetChildren()) do
if Limb:IsA("Part") and Limb.Name == "Head" then
for _,Limb2 in pairs(Player:GetChildren()) do
if Limb2:IsA("Part") and Limb2.Name == "Torso" then
for _,Limb3 in pairs(Player:GetChildren()) do
if Limb3:IsA("Part") and Limb3.Name == "Right Arm" then
for _,Limb4 in pairs(Player:GetChildren()) do
if Limb4:IsA("Part") and Limb4.Name == "Left Arm" then
for _,Limb5 in pairs(Player:GetChildren()) do
if Limb5:IsA("Part") and Limb5.Name == "Right Leg" then
for _,Limb6 in pairs(Player:GetChildren()) do
if Limb6:IsA("Part") and Limb6.Name == "Left Leg" then
for i = 1, 10 do Limb.Transparency, Limb2.Transparency, Limb3.Transparency, Limb4.Transparency, Limb5.Transparency, Limb6.Transparency = Limb.Transparency + 0.1, Limb2.Transparency + 0.1, Limb3.Transparency + 0.1, Limb4.Transparency + 0.1, Limb5.Transparency + 0.1, Limb6.Transparency + 0.1 Limb.face.Transparency = Limb.face.Transparency + 0.1
wait(0.1)
end
wait(5)
for i = 1, 10 do
Limb.Transparency, Limb2.Transparency, Limb3.Transparency, Limb4.Transparency, Limb5.Transparency, Limb6.Transparency = Limb.Transparency - 0.1, Limb2.Transparency - 0.1, Limb3.Transparency - 0.1, Limb4.Transparency - 0.1, Limb5.Transparency - 0.1, Limb6.Transparency - 0.1
Limb.face.Transparency = Limb.face.Transparency - 0.1
wait(0.1)
end
end
end
end
end
end
end
end
end
end
end
end
end
end
Convert()
end
end
script.Parent.MouseButton1Click:connect(InvisiblePlayer)



“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 05:16 PM
t.t This is really confusing.


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
18 Sep 2015 05:22 PM
Bump.


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
18 Sep 2015 06:05 PM
Pseudo code because I'm on laptop.

for i = 0, 1, 0.05 do
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
v.Transparency = i
end
end
end
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
18 Sep 2015 06:06 PM
Also add a wait() inbetween the last 2 ends.
Report Abuse
IllegallyBlind is not online. IllegallyBlind
Joined: 07 Nov 2010
Total Posts: 1691
18 Sep 2015 06:19 PM
Ugh.

for trans = 1, 20 do
for i = 1, #parts do
parts[i].Transparency = trans/20
end
wait()
end


I was gonna make a dubstep joke but I guess ill just drop it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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