You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to accelerate my vehicle instantly to the maximum force that I set on my VectorForce. -
What is the issue? Include screenshots / videos if possible!
It takes time for my vehicle to accelerate to it’s maximum force
Also, the value of the force is 500 at X axis
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
-I tried to increase the value of the force and it instantly accelerated my vehicle, but it also increases my maximum force thus speeding up vehicle which is something that I don’t want to achieve. For recalling, I just want my vehicle to have an average speed which also instantly accelerates to that speed.
-I’m about to use BodyForces which I believe has the option regarding with my issue, but the Developer Page stated that the item is deprecated, which recommends me to use VectorForce instead.
-I also learned the other methods of creating vehicles through hinges and Vehicle seat, But as of now I’m focusing on using VectorForces because I find it applicable for what I am going for (another topic). Thus, I really hope it is possible to instantly accelerate the vehicle.
By the way, here is my code which fires whenever I press “W”
local ContextActionService = game:GetService("ContextActionService")
local Players = game:GetService("Players")
-- Variable for the player
local player = game.Players.LocalPlayer
-- Configuration variables
-- Sets the player's speed: The larger the negative number, the faster the ship will go.
local PLAYER_SPEED = 500
local FORWARD_KEY = Enum.KeyCode.W
-- Creates a force vector that uses player's speed
local forwardForceVector = Vector3.new(PLAYER_SPEED,0,0)
-- Movement function that is called when the player presses the move forward button
local function onMove(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
-- If the player presses down the button, move forward
player.Character.HumanoidRootPart.VectorForce.Force = forwardForceVector
elseif inputState == Enum.UserInputState.End then
-- If the player releases the button, stop moving
player.Character.HumanoidRootPart.VectorForce.Force = Vector3.new(0,0,0)
end
end
-- Set up control bindings
ContextActionService:BindAction("Move", onMove, false, FORWARD_KEY)
As you may also notice, I am getting the Character’s humanoid root part, that’s because I changed the starter character to a vehicle, which makes the humanoid root part equivalent to the root part of my vehicle.
This is also the current structure of the vehicle as well.
In Accordance with the code, this would move the car forward whenever I press “W” (and it would not stop).
This is not the whole design of the car though but I just made it simple for the post.
Thank you so much!
I’m also new to Roblox studio as well, started like 2 weeks ago.