|
| 16 Apr 2016 09:59 PM |
I know how to make it but there's a lot of repetition and I'm not sure how to do it efficiently.
|
|
|
| Report Abuse |
|
|
| |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 10:03 PM |
You mean like their characters? I would use a for loop.
For instance, this will make the part's transparency quickly go from 0 to 1:
local p = part
for i=1, 10 do p.Transparency = p.Transparency - 1 end
u sicko! |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 10:11 PM |
Well, I can't change the transparency of the character as a whole, but what's an efficient way I can do it to each part?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Apr 2016 10:15 PM |
-- put the code below in a local script. your character's torso should fade away when they touch the part. You can add in more code yourself to make the characters arms, legs, head etc... face away. --
local player = game.Player.LocalPlayer local part = game.Workspace.Part -- lets assume you have a part in workspace called "part"
part.Touched:connect(function() repeat player.Character.Torso.Transparency = player.Character.Torso.Transparency + 1 wait(.1) until player.Character.Torso.Transparency ===1 end end) |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 10:16 PM |
Also for loops :) This time, you would use it to iterate through all of the parts inside of the character.
local character = game.Workspace.Character
for i,v in pairs(character:GetChildren()) do if v:IsA("BasePart") then fori=1, 10 do v.Transparency - v.Transparency -.1 end end end
u sicko! |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Apr 2016 10:16 PM |
It must be in a regular script, basically when I hit a door I want an efficient way to slowly fade myself. I know how to make the loop.
|
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 10:17 PM |
| @exo, use klink's code, his is more efficient. |
|
|
| Report Abuse |
|
|
Dr_Doge
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 645 |
|
|
| 16 Apr 2016 10:17 PM |
function Fade(obj) a=0 repeat local children = obj:GetChildren() for i = 1, #children do if children[i].ClassName=='Part' then children[i].Transparency=a a=a+0.1 end until a==1 end end
Fade(game.Players.LocalPlayer.Character)
--That should work. |
|
|
| Report Abuse |
|
|
| |
|
Dr_Doge
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 645 |
|
| |
|