I am trying to address a body velocity in my script while having a while true do function play on it but i am having no luck finding out how to do so.
here's what i have
local b = Instance.new("BodyVelocity")
b.Parent = v
b.MaxForce = Vector3.new(1e8,1e8,1e8)
b.Velocity = char.HumanoidRootPart.CFrame.lookVector*155
wait(0.5)
cast = true
while cast == true do
b.Velocity = mouse.Hit.lookVector*155
wait(0.5)
end
ive tried putting the cast == true do function at the end but it cant reference b then and ive tried using another script and adding it to the body velocity but then it cant reference the player/mouse

2 comments
you can use coroutines or the spawn function
alright i learned about the corountines, thanks.