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
 

How To Give Each Ball A Different CFrame?

Previous Thread :: Next Thread 
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
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
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
23 Nov 2014 01:34 PM
bump
Report Abuse
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
23 Nov 2014 01:49 PM
bump
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
23 Nov 2014 01:51 PM
Use math.random(min#, max#)



U wot m8
Report Abuse
DracoTrainingMaster is not online. DracoTrainingMaster
Top 100 Poster
Joined: 14 Oct 2006
Total Posts: 524
23 Nov 2014 01:53 PM
You want a cloud, or more then one over you head?
Report Abuse
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
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 is not online. 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
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