I am trying to make the player walk in a wavy dizzy/drunk direction but I cannot get Humanoid:Move() or Player:Move() to work at all! Here is what I currently have, trying to recreate basic movement by disabling the default control system.
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local humanoid = Players.LocalPlayer.Character.Humanoid
local function dizzyForward()
print("moving forward")
humanoid:Move(Vector3.new(0,0,-1), false)
end
local function dizzyBackward()
print("moving backward")
humanoid:Move(Vector3.new(0,0,1), false)
end
local function dizzyLeft()
print("moving left")
humanoid:Move(Vector3.new(1,0,0), false)
end
local function dizzyRight()
print("moving right")
humanoid:Move(Vector3.new(-1,0,0), false)
end
local FROZEN_ACTION_KEY = "freezeMovement"
ContextActionService:BindActionAtPriority(
FROZEN_ACTION_KEY,
function()
return Enum.ContextActionResult.Sink
end,
false,
Enum.ContextActionPriority.High.Value,
unpack(Enum.PlayerActions:GetEnumItems())
)
ContextActionService:BindActionAtPriority("Forward", dizzyForward, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.W, Enum.KeyCode.Up)
ContextActionService:BindActionAtPriority("Backward", dizzyBackward, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.S, Enum.KeyCode.Down)
ContextActionService:BindActionAtPriority("StrafeLeft", dizzyLeft, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.A, Enum.KeyCode.Left)
ContextActionService:BindActionAtPriority("StrafeRight", dizzyRight, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.D, Enum.KeyCode.Right)
local function stop()
print("enabling controls again")
ContextActionService:UnbindAction(FROZEN_ACTION_KEY)
end
ContextActionService:BindActionAtPriority("end", stop, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.Y)
I have also tried a simpler version, without directly disabling all player input
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local humanoid = Players.LocalPlayer.Character.Humanoid
local function dizzyForward()
print("moving forward")
humanoid:Move(Vector3.new(0,0,-1), false)
end
local function dizzyBackward()
print("moving backward")
humanoid:Move(Vector3.new(0,0,1), false)
end
local function dizzyLeft()
print("moving left")
humanoid:Move(Vector3.new(1,0,0), false)
end
local function dizzyRight()
print("moving right")
humanoid:Move(Vector3.new(-1,0,0), false)
end
ContextActionService:BindAction("Forward", dizzyForward, false, Enum.KeyCode.W, Enum.KeyCode.Up)
ContextActionService:BindAction("Backward", dizzyBackward, false, Enum.KeyCode.S, Enum.KeyCode.Down)
ContextActionService:BindAction("StrafeLeft", dizzyLeft, false, Enum.KeyCode.A, Enum.KeyCode.Left)
ContextActionService:BindAction("StrafeRight", dizzyRight, false, Enum.KeyCode.D, Enum.KeyCode.Right)
Both of these scripts only execute the print statements with no movement.
I have had no luck looking at previous posts relating to :Move() so would appreciate any help!