zack785
|
  |
| Joined: 06 Feb 2009 |
| Total Posts: 419 |
|
|
| 01 Nov 2012 06:46 PM |
I'm trying to figure out how to make parts invisble onTouch.. I tried using some old tricks like
local brick = script.Parent function onTouch(part) part.Transparency = 1 wait(1) part.Transparency = 0 end
brick.Touched:connect(onTouch)
but I guess that didn't work out because it will only make the singular part you touched with invsible, so if everything doesn't touch it won't work.. Any help is appreciated. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Nov 2012 06:49 PM |
local brick = script.Parent
local t = 0
function onTouch(part) if t == 1 then return end t = 1 if part:IsA("Part") then part.Transparency = 1 wait(1) part.Transparency = 0 end t = 0 end
brick.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 01 Nov 2012 07:28 PM |
You want the part that they touched to become invisible?
Replace part with brick on lines 2 and 4 |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:31 PM |
for -1,1,.01 do brick.Transparency=math.abs(i) wait(.03) end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 01 Nov 2012 07:33 PM |
Umm...yur mom
~'Cause dinosaurs roar~ |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:34 PM |
| You're cool, Chop... qq... |
|
|
| Report Abuse |
|
|
| |
|
zack785
|
  |
| Joined: 06 Feb 2009 |
| Total Posts: 419 |
|
|
| 01 Nov 2012 07:39 PM |
| No, I knew how to change the brick trans, I was changing the players trans.. but I wanted when they touched it for their whole body to become invsible. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Nov 2012 07:39 PM |
for i,v in pairs(h.Parent:GetChildren()) do if v:IsA("Part") then v.Transparency = 1 end end |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:41 PM |
script.Parent.Touched:connect(function(c) if game:GetService("Players"):GetPlayerFromCharacter(c.Parent)then for _,v in pairs(c.Parent:GetChildren())do if v:IsA("Part")then v.Transparency=0 if v.Name=="Head"then v:FindFirstChild("face").Transparency=0 end elseif v:IsA("Hat")then v:FindFirstChild("Handle").Transparency=0 elseif v:IsA("Tool")then for _,x in pairs(v:GetChildren())do if x:IsA("Part")then x.Transparency=0 end end end end end end)
OLOLOLOLOLO |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:45 PM |
script.Parent.Touched:connect(function(obj) pcall(funtion() for k,v in pairs(obj:GetChildren()) do v.Transparency = 1 v.Handle.Transparency = 1 v.face.Transparency = 1 end end) end)
BUAHAHH |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:46 PM |
| I will now go make pan cakes since I'm hungry and my mom bought eggs, but no bread so yeah, no sandwich :C |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:47 PM |
Well uh-sorry that I don't purposely cause errors in my script and abuse pcall -_-
i go for efficiency, not less typing. c: |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 07:50 PM |
| no pan cakes since no butter :l |
|
|
| Report Abuse |
|
|
zack785
|
  |
| Joined: 06 Feb 2009 |
| Total Posts: 419 |
|
|
| 01 Nov 2012 08:01 PM |
| Also guys, if you don't know... I am kind of a noob to scripting, that's why I used such as basic script as an example so when you give me all these complex weird scripts it's confusing. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:08 PM |
Don't worry about understanding those scripts, none of them will actually fix your problem.
I would recommend putting everything you want to change transparency in a Model object (cntrl+g to group things into a model) and then 'iterating' through each object in the model. To do this, first create a table of the models objects using the :GetChildren() method. Then use a for loop to individually set the transparency of each object. That would look something like this:
for i = 1, 0, -1 do g = Model:GetChildren() for c = 1, #g do g[c].Transparency = i end wait(1) end
That actually uses a 'nested' for loop (1 inside another). The first one takes the value 'i' from 1 to 0, and that is what your transparency is set to. The second one takes the value 'c' from 1 to the number of objects in your model, and g[c] will be the "Cth" object in the model. When c = 1, g[c] is the first item, and so on. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:10 PM |
*edit* 1) The second 'fixed' script in the threat would work if roblox collisions worked better. 2) Move the 'g = Model:GetChildren()' line out of the loops so that the line is only ran once.
Hope that helps a little :) |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:12 PM |
*edit again*
*facepalm*
Thread, not threat. And the first 'fixed' script in this thread, not the second. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:13 PM |
| @Green, I though 'fixed' meant working, which your's doesn't. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:16 PM |
*xxchopslaperxx maik some bacon and put some melted cheese on et. Dur breakfast
~'Cause dinosaurs roar~ |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:18 PM |
| @xxchop, I don't post here to fix scripts or write scripts. I post here to teach scripting. My comment that one of the scripts posted would fix the problem only meant that none of the scripts posted would fix the problem. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:19 PM |
| Well, your teaching can lead to errors.. |
|
|
| Report Abuse |
|
|
zack785
|
  |
| Joined: 06 Feb 2009 |
| Total Posts: 419 |
|
|
| 01 Nov 2012 08:20 PM |
| Firstly, please stop trolling on this fourm, secondly that still made little to no sense to me.. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 08:20 PM |
| XD That's right. And if math wasn't taught in schools children wouldn't make math errors either. |
|
|
| Report Abuse |
|
|