So i’ve been trying to make a ControlScript to replace the ControlModule in StarterPlayerScripts, this is what i have so far and it’s actually pretty choppy, i can’t walk in two directions like in the default ControlModule, does anyone know how did they do that in ControlModule? I did try looking at it just in case someone asks, but it’s pretty unreadable, at least for me it looks like a big mess.
This is my script so far:
--[[ Functions ]]--
local function walkForwardAction(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
humanoid:Move(Vector3.new(0, 0, -1), true)
elseif inputState == Enum.UserInputState.End then
humanoid:Move(Vector3.new(0, 0, 0), false)
end
end
local function walkLeftAction(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
humanoid:Move(Vector3.new(-1, 0, 0), true)
elseif inputState == Enum.UserInputState.End then
humanoid:Move(Vector3.new(0, 0, 0), false)
end
end
local function walkBackwardAction(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
humanoid:Move(Vector3.new(0, 0, 1), true)
elseif inputState == Enum.UserInputState.End then
humanoid:Move(Vector3.new(0, 0, 0), false)
end
end
local function walkRightAction(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
humanoid:Move(Vector3.new(1, 0, 0), true)
elseif inputState == Enum.UserInputState.End then
humanoid:Move(Vector3.new(0, 0, 0), false)
end
end
local function jumpAction(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
humanoid.Jump = true
elseif Enum.UserInputState.End then
humanoid.Jump = false
end
end
--[[ Bind Actions ]]--
ContextActionService:BindAction("WalkForwardAction", walkForwardAction, false, Enum.KeyCode.W)
ContextActionService:BindAction("WalkLeftAction", walkLeftAction, false, Enum.KeyCode.A)
ContextActionService:BindAction("WalkBackwardAction", walkBackwardAction, false, Enum.KeyCode.S)
ContextActionService:BindAction("WalkRightAction", walkRightAction, false, Enum.KeyCode.D)
ContextActionService:BindAction("JumpAction", jumpAction, false, Enum.KeyCode.Space)
I’d appreciate if someone helped me to solve this problem, i have absolutely no idea what to do, i can’t think about any logical solutions either, i’ve looked at priorities too, but it doesn’t seem to be the problem. ![]()