This may be more difficult than it sounds. Let's assume a user creates a part through a global script. Is there a way to make that part move in the direction of that user's mouse.Hit.p until the part no longer exists? I have been trying many things, but here is my latest attempt. If anyone knows how to do this, I would be extremely grateful! Thanks in advance.
In a local script within the part that was created...
player = game.Players.LocalPlayer while wait(.01) do if script.Parent ~= nil then local mouse = player:GetMouse() local position = mouse.Hit.p script.Parent.Velocity = CFrame.new(script.Parent.Position, position) * 70 end end
you need to use a body mover or this will never work, you cant change velocity directly, velocity is just the effect. to change velocity you need to use a bodyvelocity and from this you can do ~~~~~~~~~~~~~~~~~ bodyvelocitypath.MaxForce = Vector3.new(math.huge,math,huge,math.huge) bodyvelocitypath.Velocity = Vector3.new(mouse.Hit.p) ~~~~~~~~~~~~~~~~~