Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I go about making a boost part?

I am making a racing game and I am working on making a part the will boost the player. I want it so when the player touches it, it will launch them in the direction the Part is facing. I am NOT asking for a script! I just am having difficulties and am reliability new with CFrame. I think I will have to do something with the look vector of the part. Also would I use the velocity of the HumanoidRootPart or insert a BodyThrust or something. Here is a script that I was just testing with.

script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then
		local thrust = Instance.new("BodyVelocity")
		thrust.Parent = hit.Parent.HumanoidRootPart
		thrust.Velocity = Vector3.new(-50,0,0)
		wait(2)
		thrust:Destroy()
	end
end)

It only sends them one direction as you can see. As I send I have a feeling I need to use Look Vector but idk how to use it. The reason I want it to launch them the way the part is facing is so I don't have to change the direction for all the boosters. Thanks!

1 answer

✓ Accepted answer

Here's what I did:


script.Parent.Touched:connect(function(hit) 
	
	if hit.Parent:isA("Model") and hit.Parent.Name=='Car' then
		
		local base = hit.Parent:FindFirstChild("Drive",true)
		if base then
			
			print("FOUND THE Driver Seat!!!")
			local BV = Instance.new("BodyVelocity")
			BV.maxForce = Vector3.new(100000,100000,100000)
			BV.velocity = base.CFrame.lookVector * 1000000
			BV.Parent = base
			delay(2,function()
				BV:Destroy()
			end)
		end
	end
end)

2 comments

0

Awsome! I will try to modify it to fit my needs. Thanks!

0

Yeah you'll need to tweak it i'm sure - I amped up those values for emphasis on the action.

This discussion is preserved as it was. New answers, comments, and votes are closed.