#Bomb

27 messages · Page 1 of 1 (latest)

brave bluff
#

I have no idea how to make the parts fly correctly

storm kelp
#

i wouldnt even bother using the explotions for parts. BUT the reason they arent moving is because applyimpulse uses a vector3 (an X,Y,Z) not a singular number

#

@brave bluff

brave bluff
#

ahh

#

Idk how to make them fly

#

I've tried velocity

#

didnt work

#

you got any ideas, I've tried anything I could think of @storm kelp

storm kelp
#

i just threw this together rlly quickly @brave bluff but something like this

#
local Bomb = workspace:WaitForChild("Bomb")


local Number_Of_Parts = 20
local Duration = 5

local function Explosion()
    local Folder = Instance.new("Folder")
    Folder.Name = "BombParts"
    Folder.Parent = workspace
    
    for i = 1,Number_Of_Parts do
        local Part = Instance.new("Part")
        Part.Parent = Folder
        Part.Anchored = false
        Part.Position = Bomb.Position
        Part.Size = Vector3.new(1,1,1) --Set to whatever size u want
        
        --Not best practice but easiest imo especially for beginners
        local RandomX = math.random(1,100)
        local RandomY = math.random(1,100)
        local RandomZ = math.random(1,100)
        Part.Velocity = Vector3.new(RandomX,RandomY,RandomZ) 
        --If the velocity isnt enough you can multiple these all by something or change the random number range!
    end    
    task.wait(Duration)
    Folder:Destroy()
end

Explosion()```
#

if you dont understand any of the code its important you ask

brave bluff
#

ah

#

yeah I understand that

#

I thought velocity was removed

#

or depracicated

storm kelp
#

its depreciated yes it still works tbh just as well

#

if u want to use ApplyImpulse it works just as well

#

also

#

.AssemblyLinearVelocity isnt depreciated but it isnt suggested that u use it

#

best practice is apply impulse or inserting a linear velocity object

#

which would look like this

#
Part.AssemblyLinearVelocity = Vector3.new(RandomX,RandomY,RandomZ)

or 

Part:ApplyImpulse(Vector3.new(RandomX,RandomY,RandomZ))
brave bluff
#

ohhh

queen voidBOT
#

studio** You are now Level 1! **studio

brave bluff
#

thats how they work

#

thanks!

storm kelp
#

there is more complex stuff related to applyimpulse like if its a weirdly shaped part and u want it to rotate accordingly then you should use ApplyImpulseAtPosition which u can apply an impulse at a specific center of mass