Which way is the better way to move a part?

In a part of my game where there are meteors falling from the sky, a lot of them. I want to make it so the angle of each meteor is different. I know how to do a simple way, but I want to make sure it is most optimized for my game’s ability to run on laptops and phones because there are so many meteors, here are my ideas (in rank of best to worst I think):

  1. A script that uses Lookvector and velocity

  2. Tinker around with Bodyforce and Bodyvelocity

  3. A loop that moves the meteorite with lookvector and CFrame

If you know which one is the best or have better ideas please comment! Thank you for reading! :slightly_smiling_face: (P.S. I really just want this to be small computer friendly!)

You could use raycast from the lookvector of the meteorite and tween to the hit position

Thanks for the reply, I have more than ten meteorites at a time, and they are all spawned at a random position and come in waves. I don’t know if this idea would work, would it?

I think updating the CFrame in a loop is the best option, because you can keep the meteor anchored, which allows for more precise movement.
Remember to use RunService.Heartbeat so that it updates every frame (this can be used on the server).

https://developer.roblox.com/en-us/api-reference/event/RunService/Heartbeat

Hello! This idea is intriguing, would it make the game lag on a laptop or phone if I had more than or so 10 coming from the sky all at once?

It doesn’t seem to cause any lag you can move anchored parts with tweens also

1 Like

You can have 200+ falling at once and it only drops pings down 5

1 Like

It does heavily depend on the complexity of the meteors, so if you are using models it might lag a little, but singular parts will be fine.

1 Like

Thank you! I have tried to tween parts and guis, but it makes no sense to me :frowning: is there any resources you could point me to?

Here’s an example of how tweens work:

local TweenService = game:GetService("TweenService")
local Part = workspace.Part

local Goal = {     --The goal properties of the part (Position simply refers to the position of the part)
    Position = Vector3.new(10, 100, 10), 
    Color = Color3.new(0, 0, 0)
}

local Tween = TweenService:Create(Part, TweenInfo.new(5, Enum.EasingStyle.Linear), Goal)
Tween:Play()

You can also use different EasingStyles and EasingDirections to create different effects.

https://developer.roblox.com/en-us/api-reference/function/TweenService/Create

1 Like

Cool, this helped a lot because I learn best with examples thank you!

i guess tween service would work

I think using bodyforce and bodyvelocity is an unstable way to move the part,I suggest you to use
tween service with cframe