Im new to scripting so im very bad at it but I have a problem where I want to make a car (I know theres a classic way to make it without scripting but I dont want to make one like that) so if I press the WASD buttons it will move, and the first thing i want to do it to make it move in any direction when I press W. The code for detecting a key works (I added a KeyRemote called KeyDown in replicated storage) and the local script is in StarterGui, but I put a script in ServerScriptService and the code that made the part move didnt work.
Car moving script (dosen't work)
local KeyDownEvent = game:GetService("ReplicatedStorage"):WaitForChild("KeyDown") -- Defines the RemoteEvent
local car = game.Workspace.car
KeyDownEvent.OnServerEvent:Connect(function() -- This function runs when a player fires it
car.Position = car.Vector3.new(-1,-1,-1)
end)
Key Detection script (Works)
local UIS = game:GetService("UserInputService") -- Gets the UserInputService that detects the players inputs
local KeyDownEvent = game:GetService("ReplicatedStorage"):WaitForChild("KeyDown") -- Defines the RemoteEvent
UIS.InputBegan:Connect(function(input) -- This function runs when the player presses a key
if input.KeyCode == Enum.KeyCode.W then -- Checks if the pressed key was E
KeyDownEvent:FireServer() -- Tells the server that the player pressed E
end
end)

1 comment
The code worked for changing the position but my question was how do I make it to continue moving? Like how a normal car keeps moving when you make it go im wondering how to make a script like that, and when you let go of the key it stops, from when i play it i see its putting it somewhere else. I think im asking too much but Im sry idrk scripting at all.