Before 2016, Roblox allowed people to set negative numbers on WalkSpeed property, but as of now it’s clamped to be 0
If you were to set the walkspeed to be negative (eg. -16) then your controls would’ve been inverted
This is a better way of just inverting controls without having to access PlayerModule since you have to replace the way movement is handled and stuff like that
As “neat” as that interaction was, probably not desirable because many things consuming WalkSpeed like animation can’t necessarily tolerate a negative value.
If this were allowed again it would be an endless source of edge case bugs because inevitably not enough engineers / QA / etc at the company would know to test with it when adjusting movement, animation and other behaviors.
In the long run the InputActionSystem is going to offer better ways to remap input for stuff like this.
I do wanna add inverse movement to my game at certain moments but we currently don’t use IAS at the moment. We may need to switch to using IAS if that’s the case for future works.
Consider also that the default input scheme for platform avatars will likely switch towards using the InputActionSystem as its foundation rather than the raw UserInputService input.
FWIW you can achieve the same behavior today like this. RenderStepped is in just the right place to intercept and override the movement from the player control script right before the humanoid actually moves.
local RunService = game:GetService("RunService")
local humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
RunService.RenderStepped:Connect(function()
humanoid:Move(-humanoid.MoveDirection, false)
end)
You get more control this way too, you could apply additional effects such as noise driven random movement.
I am not sure how inverse movement would work for IAS considering PlayerModule seems to not use it. It seems like editing the player module is the easiest way to inverse controls for both mobile and PC.
Is there a version of PlayerModule that uses IAS so I can just edit the context? Or is there a way I can tell the player module what the direction it is without editing it?
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local playerScripts = localPlayer:WaitForChild("PlayerScripts")
local playerModule = require(playerScripts:WaitForChild("PlayerModule"))
local movementController = playerModule:GetControls()
local function inverse(player: Player, direction, relative)
player.Move(player, -direction, relative)
end
while true do
movementController.moveFunction = inverse
task.wait(10)
movementController.moveFunction = localPlayer.Move
task.wait(10)
end
I’m wary about interacting with the PlayerModule because it has aggressively changed before in the past to lock off or remove API. It’s not tightly controlled by the developer, Roblox can change it at any time if you don’t version-lock it.