Hi, I am just wondering whether it would be better to use body force, body velocity etc. instead of CFrame for this. I am also wondering how one would do this as I don’t actually understand all the different body movers. I am asking about this because I am using a vehicle seat and using those properties I think acceleration is already built in. Also overall I have heard discussion before about which is better so I am not sure. This is my current code (any additional suggestions are welcome):
local inputS=game:getService("UserInputService")
local player = game.Players.LocalPlayer
local upgui = player.PlayerGui.Hovercc.Up
local dngui = player.PlayerGui.Hovercc.Down
local seat = game.Workspace.Up.VehicleSeat
local ig = seat.Parent.Ign
local molpart = seat.Parent.Body
local up, dn
inputS.InputBegan:connect(function(input)
local code=input.KeyCode
if code==Enum.KeyCode.Q then
up=true
end
end)
inputS.InputBegan:connect(function(input)
local code=input.KeyCode
if code==Enum.KeyCode.E then
dn=true
end
end)
upgui.InputBegan:Connect(function()
up = true
end)
dngui.InputBegan:Connect(function()
dn = true
end)
upgui.InputEnded:Connect(function()
up = false
end)
dngui.InputEnded:Connect(function()
dn = false
end)
inputS.InputEnded:connect(function(input)
local code=input.KeyCode
if code==Enum.KeyCode.Q then
up=false
end
end)
inputS.InputEnded:connect(function(input)
local code=input.KeyCode
if code==Enum.KeyCode.E then
dn=false
end
end)
ig:GetPropertyChangedSignal("Value"):Connect(function()
if ig.Value == true then
if inputS.TouchEnabled then
upgui.Visible = true
dngui.Visible = true
end
print("True")
repeat
if up then
local rotatedCFrame = CFrame.Angles(0, 0, math.rad(1))
molpart.CFrame = molpart.CFrame:ToWorldSpace(rotatedCFrame)
elseif dn then
local negrotatedCFrame = CFrame.Angles(0, 0, -0.0174533)
molpart.CFrame = molpart.CFrame:ToWorldSpace(negrotatedCFrame)
end
if seat.Steer == 1 then
local newCFrame = molpart.CFrame * CFrame.Angles(0, -math.rad(1), 0)
molpart.CFrame = newCFrame
elseif seat.Steer == -1 then
local newCFrame = molpart.CFrame * CFrame.Angles(0, math.rad(1), 0)
molpart.CFrame = newCFrame
seat.Transparency = 1
else
seat.Transparency = 0
end
if seat.Throttle == 1 then
local foroffsetCFrame = CFrame.new(5, 0, 0)
molpart.CFrame = molpart.CFrame:ToWorldSpace(foroffsetCFrame)
elseif seat.Throttle == -1 then
local foroffsetCFrame = CFrame.new(-5, 0, 0)
molpart.CFrame = molpart.CFrame:ToWorldSpace(foroffsetCFrame)
end
wait()
until ig.Value == false
end
end)