Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make objects spawn around you like this?

Background

In this DBZ game there are brick particles that spawn around the player and slowly float up and rotate as if there's no gravity around them.

-Example: {https://www.gyazo.com/07dd3dc17728c553863c922c252341a0

Question

  1. What are some ways I could get the bricks to randomly spawn around me in this manner (in front and behind).

  2. How would I make them float as shown?

  3. Is there a way to get them to spawn in a circle around me?

2 answers

  1. This can be done by either using constraints or CFraming.

  2. You can spawn them on the borders of a cylindrical space.

local fxz,fy=function(poff,t)--[[stuff here]]-- end function(poff,t)--[[stuff here]]-- end
local parts = {}
local st=tick()
game:GetService("RunService").RenderStepped:Connect(function()
      local cp = HumanoidRootPart.Position
      for i,v in next, parts do
             local x,z=fxz(v.Offset.X)
             v.Obj.Position=Vector3.new(x,fy(v.Offset.Y),z)+cp
      end
end)

2 comments

0

Could you show me a code close to something I could use for cframing?

0

You can use a combination of 2 functions, 1 for the x,z plane and the other for y. I don't have a function ready right now, but I'll add the base of the code that moves the parts using the functions to my answer.

You can spawn them by using math.random and give them a body velocity to make them move upwards. (Just imagining what you mean since the gyazo isn't working.)

For example, this will make them spawn in a range of 40 or -40 studs away.

part.Position = character.Torso.Position + Vector3.new(math.random(-40,40),math.random(-40,40),math.random(-40,40))

As for making the body velocity, just create a new body velocity and set it's velocity upwards.

local bv = Instance.new('BodyVelocity')
bv.Parent = part
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = Vector3.new(0,5,0)

1 comment

0

It does work, but you need to copy the URL text and paste it in a new tab. He wants the parts to circle around the player.

This discussion is preserved as it was. New answers, comments, and votes are closed.