I’m trying to re-create custom movement that feels like the default one, but for the purpose that all the controls can be customised and changed.
I have two variables that change with inputs:
movez = 0
movex = 0
Where if you press W for example it will be set to 1 and if you release it will be 0, if you press S it will go to -1, and same for movex where A is -1.
I’m wondering about how I would go about moving the character (note: This will be first person so no third person stuff to worry about), so that it moves in the direction of the camera and desired inputs and feels like the default movement system?
All I know is I might need to use this:
local direction = camera.CFrame.lookVector
I’m not sure whether it should be updated on the client or on the server, because the client could hack it and do a speed hack but on the server the client will see input lag if there connection is slow (>5ms which is kinda crazy)
note: if anyone’s wondering how I decided the input:
local movez = 0
local movex = 0
local movements = {
["forw"] = Enum.KeyCode.W,
["left"] = Enum.KeyCode.A,
["back"] = Enum.KeyCode.S,
["righ"] = Enum.KeyCode.D,
["jump"] = Enum.KeyCode.Space
}
local inputs = setmetatable({}, {
__index = function(t, k)
return uis:IsKeyDown(movements[k]) and true or false
end
})