LinearVelocity Function

Hello, I have a brick with proximimty prompt with a function script, I am not sure how to script linearvelocity inside the function to move the brick when the prompt is triggered.

Thank you for any help

Well you’ll need a direction and a force but I’ll let you fill those in. This code goes in a script placed in the aforementioned brick.

local BasePart = script.Parent

BasePart.ProximityPrompt.Triggered:Connect(function(PlayerWhoTriggered)
	BasePart.AssemblyLinearVelocity = Direction * Force
end)
1 Like

I’m not sure what numbers would go in the direction+force, would that just be the vectorvelocity?#

I tried making my own script and got a timeout error

local Linearvelocity = script.parent.parent.LinearVelocity 

script.Parent.Triggered:Connect(function()
	
	while true do 
		Linearvelocity.VectorVelocity = Vector3.new (10,0,0)
	end
end)

remove the while true do. LinearVelocity objects will apply up to MaxForce to reach VectorVelocity as long as it is Enabled. 10 is pretty low try a higher number

1 Like

I’ve removed the while true do, and my max force is set to inf. now nothing happens at all with the script, and there’s no error messages in the output

set Vector Velocity higher, if it’s (10, 0, 0) it will do largely nothing. try (300, 0, 0). Max force should probably not be infinite or it will be jittery

1 Like

Try this:


local BasePart = script.Parent

BasePart.ProximityPrompt.Triggered:Connect(function(PlayerWhoTriggered)
	BasePart.AssemblyLinearVelocity = Vector3.new(0,0,1) * 1000000
end)

1 Like