Can you change bodypostion.Value with a local script?

My car is not moving, and the topic is the question.

The script:

local canwork = true
local uis = game:GetService("UserInputService")

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
    canwork = true
    print("Car works now")
end)

uis.InputBegan:Connect(function(key,ischatting)
    if canwork == true then
        local success,errormessage = pcall(function()
            print("Car starting to move")
            if canwork == true and key.KeyCode == Enum.KeyCode.W and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.LookVector*15
                wait(1)
                canwork = true
            elseif canwork == true and key.KeyCode == Enum.KeyCode.A and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.RightVector*-15
                wait(1)
                canwork = true
            elseif canwork == true and key.KeyCode == Enum.KeyCode.S and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.RightVector*15
                wait(1)
                canwork = true
            elseif canwork == true and key.KeyCode == Enum.KeyCode.D and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.LookVector*-15
                wait(1)
                canwork = true
            end
        end)
        if success then
            print("Car Moved")
        else
            print(errormessage)
        end
    end
end)

Uh can anyone tell me how to fix it please?

Why are you using a local script for your car only the one person can see it move that is why it is not moving you are calling it through a local script

Its my first time making a car, i am first trying to use a local script then go to complex one of car

I think it’s because he needs the UserInputService

yes and i am new in making a car to

This is in a localscript or a script?

local script its sometimes working and sometimes not working, and even if it works its going front and back only, its not turning left and right maybe wheels wont turn

Ok I fix it but why is it not turning correctly.

Here is the script:

local canwork = false
local uis = game:GetService("UserInputService")
local rotation = nil

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
    canwork = true
    print("Car works now")
end)

uis.InputBegan:Connect(function(key,ischatting)
    if canwork == true then
        local success,errormessage = pcall(function()
            print("Car starting to move")
            if canwork == true and key.KeyCode == Enum.KeyCode.W and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.LookVector*15
                canwork = true
            elseif canwork == true and key.KeyCode == Enum.KeyCode.A and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyGyro.CFrame = game.Workspace.CarBase.CFrame * CFrame.lookAt(game.Workspace.CarBase.Position,game.Workspace.CarBase.Position + game.Workspace.CarBase.CFrame.RightVector*20)
                rotation = game.Workspace.CarBase.CFrame * CFrame.lookAt(game.Workspace.CarBase.Position,game.Workspace.CarBase.Position + game.Workspace.CarBase.CFrame.RightVector*20)
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.RightVector*-15
                canwork = true
            elseif canwork == true and key.KeyCode == Enum.KeyCode.S and ischatting ~= true then
                canwork = false
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.LookVector*-15
                canwork = true
            elseif canwork == true and key.KeyCode == Enum.KeyCode.D and ischatting ~= true then
                canwork = false
                rotation = game.Workspace.CarBase.CFrame * CFrame.lookAt(game.Workspace.CarBase.Position,game.Workspace.CarBase.Position + game.Workspace.CarBase.CFrame.RightVector*-20)
                game.Workspace.CarBase.BodyGyro.CFrame = game.Workspace.CarBase.CFrame * CFrame.lookAt(game.Workspace.CarBase.Position,game.Workspace.CarBase.Position + game.Workspace.CarBase.CFrame.RightVector*-20)
                game.Workspace.CarBase.BodyPosition.Position = game.Workspace.CarBase.BodyPosition.Position + game.Workspace.CarBase.CFrame.RightVector*15
                canwork = true
            end
        end)
        if success then
            print("Car Moved")
        else
            print(errormessage)
        end
    end
end)

while wait(0.5) do
    if canwork == true and rotation ~= nil then
        game.Workspace.CarBase.BodyGyro.CFrame = rotation
    end
end

try checking this car maybe?

If the car is handled on the server-side, you should change the NetworkOwnership to be the player when you call the FireClient() function, otherwise handling it on the server can result in some wonky & odd effects

It’s either that or BodyPositions handled on the server-side work funny

the car is working but not turning left and right correctly