#How to apply velocity onto parts?

1 messages · Page 1 of 1 (latest)

fair wind
#

I made these abilities to fling blocks towards the player's cursor, and im not gonna lie i didnt know how so i asked chatgpt, it told me to use AssemblyLinearVelocity. However its extremely buggy and sometimes the blocks dont move, just fall to the ground, or do fling but lag a lot. Its apparent to me that this cant be the best way to make the blocks move. I want a set speed, not speed based on distance. Is there another type of velocity? what should i use that isn't absolutely horrid?

  local speed = 1000
  
  local dir = (mousepos - part.Position).Unit
  part.AssemblyLinearVelocity = dir * speed
                    
  game:GetService("Debris"):AddItem(part, 3)

lags even at low speeds, also this code is looped through a group of parts, so the player can select parts and then fling them all at once. However lag is still there with just one part, so im positive it isnt the looping that is causing the lag

daring galleon
#

I recommend using either bodyforce or bodyvelocity , despite being deprecated they're still reliable.

#

another thing, the speed might be different than what you're looking for, so just try different speeds till you get one you want.

odd schoonerBOT
#

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

fair wind
#

tysm goat

left cloak
#

Look on :ApplyImpulse()

#

Way more cleaner

zenith oriole
#

you can use applyimpulse

odd schoonerBOT
#

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

zenith oriole
#

if its a model do it on its primary part

fair wind
#

alright thanks

#

you guys solved my question but another one: what if i wanted to apply a constant velocity?

#

like if i wanted something to fly in the air and not just fling it

#

actually nevermind