|
| 23 Nov 2014 01:25 PM |
me = game.Workspace:FindFirstChild("Player")
sno = "SmoothNoOutlines" rain = true
clouds = {
"clouda", "cloudb",
"cloudc", "cloudd",
"cloude", "cloudf",
"cloudg", "cloudh",
"cloudi", "cloudj",
"cloudk", "cloudl"
}
for i,v in ipairs(clouds) do v = Instance.new("Part", game.Workspace) v.Name = (clouds[i]) v.Size = Vector3.new(4,4,4) v.Shape = "Ball" v.BrickColor = BrickColor.new("Institutional white") v.Position = Vector3.new(0,69*69,0) v.FrontSurface = sno v.BackSurface = sno v.BottomSurface = sno v.LeftSurface = sno v.RightSurface = sno v.TopSurface = sno end
wait(0.50)
welds = {"w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10", "w11", "w12"}
for i,v in ipairs(welds) do v = Instance.new("Weld") v.Parent = game.Workspace[clouds[i]] v.Part0 = v.Parent v.Part1 = me.Head v.C1 = CFrame.new(0,24,0) -- ?????? end
I'm creating a script that makes a cloud over my head, and well, smoke doesn't work very well, especially if you're moving, so I decided to use balls instead.
My first attempt had 12, 9-lined blocks of code defining each ball. But that seems to long.
So I decided to iterate through a table, and well... here it is.
But when I run it, it places every single ball inside each-other, above my head.
How can I give every ball a different CFrame? |
|
|
| Report Abuse |
|
| |
| |
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 23 Nov 2014 01:51 PM |
Use math.random(min#, max#)
U wot m8 |
|
|
| Report Abuse |
|
|
| 23 Nov 2014 01:53 PM |
| You want a cloud, or more then one over you head? |
|
|
| Report Abuse |
|
|
| 23 Nov 2014 02:27 PM |
@Draco
I want to combine the balls, to form a cloud like structure over my head. |
|
|
| Report Abuse |
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 23 Nov 2014 04:13 PM |
If you want an accurate cloud you should iterate their CFrames so that they randomly offset each other.
local last = CFrame.new(0,10,0) for _,v in pairs(blah) do local b= Instance.new('Part') b.CFrame = last.CFrame * CFrame.new(math.random(-3,3),math.random(-1,1),math.random(-3,3)) last = b.CFrame end
U wot m8 |
|
|
| Report Abuse |
|