Hey,
what do am I trying to achieve?
I want to put a force on my part which allows me to push it forward/backward and left/right. I have been watching some programming videos and as many other studios I have tried to but a velocity on the part.
Here is my script:
local inputs = game:GetService("UserInputService")
local phumanoid = game.Workspace.phumanoid
local camera = game.Workspace.Camera
camera.CameraSubject = phumanoid
inputs.InputBegan:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.W then
phumanoid.Velocity.Z += 15
end
if inp.KeyCode == Enum.KeyCode.S then
phumanoid.Velocity.Z += -15
end
if inp.KeyCode == Enum.KeyCode.D then
phumanoid.Velocity.X += 15
end
if inp.KeyCode == Enum.KeyCode.A then
phumanoid.Velocity.X += -15
end
end)
inputs.InputEnded:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.W then
phumanoid.Velocity.Z += 0
end
if inp.KeyCode == Enum.KeyCode.S then
phumanoid.Velocity.Z += 0
end
if inp.KeyCode == Enum.KeyCode.D then
phumanoid.Velocity.X += 0
end
if inp.KeyCode == Enum.KeyCode.A then
phumanoid.Velocity.X += 0
end
end)
So the idea is to let a part glide on the baseplate.
I mean the script explains everything so what have I been programming wrong?
