Need help with scripting a Jetpack

Hey Everyone!

For an upcoming group game I would like to make jetpacks.
I have had them modelled but I was wondering how I would script them.
How would I move the character? How do I attach it to the player?

unknown

Any help would be appreciated

3 Likes

Not sure if this would help, but maybe look into using tweenservice?

2 Likes

I suggest using Body movers to move the character.

6 Likes

How would I go about body movers? I don’t usually work with positional stuff

1 Like

Take a look at BodyPosition and BodyGyro.

3 Likes

You could put the model in a tool and use a VectorForce:

VectorForce.Force = Vector3.new(0,5000,0)
Tool.Activated:Connect(function()
    VectorForce.Enabled = true
    wait(1)
    VectorForce.Enabled = false
end)
1 Like

Would I also be able to use a keybind with that?

For sure. You can bind it with ContextActionService:

local ContextActionService = game:GetService("ContextActionService")
 
local function doAction(actionName, inputState, inputObject)
	if actionName == "ActivateJetpack" then
		if inputState == Enum.UserInputState.Begin then
			VectorForce.Enabled = true
		elseif inputState == Enum.UserInputState.End then
			VectorForce.Enabled = false
		end
	end
end
 
Tool.Equipped:Connect(function()
	ContextActionService:BindAction("ActivateJetpack", doAction, true, Enum.KeyCode.E)
end)
 
Tool.Unequipped:Connect(function()
	ContextActionService:UnbindAction("ActivateJetpack")
	VectorForce.Enabled = false
end)