So lets say i have an brick moving really fast, i want to calculate the time it will take for it reach to the target brick, how can i do that? Is there any function i can use to do that?
( brick is moving straight)
Heres a image representation of what i mean :p
https://prnt.sc/mtung0
local function GetTimeToReach(part,part2,speed)--This calculates the time. return GetDistance(part,part2)/speed end local function GetDistance(part,part2)--This calculates the distance of part from part2 return (part.Position-part2.Position).Magnitude end --Ex: The part speed is 2 studs per second while wait() do local TimeToImpact=GetTimeToReach(Part,Wall,2) print("Distance: "..GetDistance(Part,Wall).." Studs. Time to impact: "..TimeToImpact) end
So take you distance, which for example might be 5 studs, and then take the speed, which might be 1 studs per second, then insert it into this formula: distance --------- = time speed In the example, the formula would be as follows: 5 studs --------- = 5 seconds 1 stud per second So just use that formula and you should be able to figure it out! Accept this answer if it solved your problem!