chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 03:08 PM |
I have many parts names "Plate"
and each have this script in it: ----------------------------------------------------------- script.Parent.Touched:connect(function(part) script.Parent.Transparency = .25 wait(.5) script.Parent.Transparency = .5 wait(.5) script.Parent.Transparency = .75 wait(.5) script.Parent.Transparency = 1 script.Parent.CanCollide = false end) -----------------------------------------------------------
Well I need that in one script, not in each part. Can I have a script with this?
|
|
|
| Report Abuse |
|
|
einsteinK
|
  |
| Joined: 22 May 2011 |
| Total Posts: 1015 |
|
|
| 31 Mar 2013 03:11 PM |
Or you put the script in every part:
local OS = TheScriptYouWantInAll for k,v in pairs(workspace:GetChildren()) do if v:IsA("Part") then OS:clone().Parent = v end end
Or you could 1 script for all: (I added also once a part is touched and it's touched agian, nothing happens)
for k,part in pairs(workspace:GetChildren()) do if part:IsA("Part") then local con = false con=part.Touched:connect(function(p) con:disconnect() part.Transparency = .25 wait(.5) part.Transparency = .5 wait(.5) part.Transparency = .75 wait(.5) part.Transparency = 1 part.CanCollide = false end) end end |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 03:12 PM |
You can try something like this in the Plates' Parent:
for Index, Key in pairs(script.Parent:GetChildren()) do if Key:IsA("BasePart") and Key.Name == "Plate" then Key.Touched:connect(function(part) --Your code end ) end end
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 03:16 PM |
@knight
"16:14:51.931 - Touched is not a valid member of Model"
:/ |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
| |
|
|
| 31 Mar 2013 03:23 PM |
Models shouldn't be BaseParts. . . Not sure why you're getting that output. Are you putting the script with all of the plates?
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 03:24 PM |
There is a Model named "Poof Plates" inside is
the script and also all the parts each called "Plates" |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 03:25 PM |
Post the script you used.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 03:26 PM |
This is my original script: ------------------------------------------------------------------------- script.Parent.Touched:connect(function(part) script.Parent.Transparency = .25 wait(.5) script.Parent.Transparency = .5 wait(.5) script.Parent.Transparency = .75 wait(.5) script.Parent.Transparency = 1 script.Parent.CanCollide = false
end) ------------------------------------------------------------------------- Could you put this correctly into your script? All the info you may need is in the post above |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
| |
|
|
| 31 Mar 2013 03:36 PM |
Ah, I see. Put your code where I indicated, but instead of "script.Parent", use "Key".
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 03:53 PM |
16:51:31.750 - Workspace.Collapsing Plates.Poof Plates.Script:18: unexpected symbol near ')'
I changed Key to Poof, hope that is OK
and here is the 20 line Script
--Poof goes the plates! -chubbs21
for Index, Poof in pairs(script.Parent:GetChildren()) do if Poof:IsA("BasePart") and Poof.Name == "Plate" then Poof.Touched:connect(function(part) Poof.Transparency = .25 wait(.5) Poof.Transparency = .5 wait(.5) Poof.Transparency = .75 wait(.5) Poof.Transparency = 1 Poof.CanCollide = false
end)
end) end end
|
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
| |
|
|
| 31 Mar 2013 04:12 PM |
for Index, Poof in pairs(script.Parent:GetChildren()) do if Poof:IsA("BasePart") and Poof.Name == "Plate" then Poof.Touched:connect(function(part) Poof.Transparency = .25 wait(.5) Poof.Transparency = .5 wait(.5) Poof.Transparency = .75 wait(.5) Poof.Transparency = 1 Poof.CanCollide = false end) end end
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 04:18 PM |
It worked!
Also do you play TheGamer101's Sword Fight Tournament? ;) |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 04:22 PM |
No problem. And not for a long time.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
chubbs21
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 18991 |
|
|
| 31 Mar 2013 04:27 PM |
Well, I happen to make maps for gamer. (Already have 2 of mine in the game)
and well,
http://www.roblox.com/Collapsing-Plates-For-TheGamer101-item?id=111378079 |
|
|
| Report Abuse |
|
|