So basically I have this script where it swaps the players body then has a movement script, however the moving is extremely wonky and doesn't work as well, aka. It's not going in correct directions sometimes and you dont move the direction you're zoomed to, help would be appreciated. Here's the script;
wait(3) -- Declare varaibles local userInputService = game:GetService("UserInputService") local runService = game:GetService("RunService") local player = workspace.test local moveVector = Vector3.new(0,0,0) userInputService.InputBegan:connect(function(inputObject) if player then if inputObject.KeyCode == Enum.KeyCode.A then moveVector = moveVector + Vector3.new(-1,0,0) end if inputObject.KeyCode == Enum.KeyCode.D then moveVector = moveVector + Vector3.new(1,0,0) end if inputObject.KeyCode == Enum.KeyCode.S then moveVector = moveVector + Vector3.new(0,0,-1) end if inputObject.KeyCode == Enum.KeyCode.W then moveVector = moveVector + Vector3.new(0,0,1) end if inputObject.KeyCode == Enum.KeyCode.Space then player.Character.Humanoid.Jump = true end end end) -- Handle inputEnded event (when player releases a key) userInputService.InputEnded:connect(function(inputObject) if player then if inputObject.KeyCode == Enum.KeyCode.A then moveVector = moveVector + Vector3.new(1,0,0) end if inputObject.KeyCode == Enum.KeyCode.D then moveVector = moveVector + Vector3.new(-1,0,0) end if inputObject.KeyCode == Enum.KeyCode.S then moveVector = moveVector + Vector3.new(0,0,1) end if inputObject.KeyCode == Enum.KeyCode.W then moveVector = moveVector + Vector3.new(0,0,-1) end end end) runService.RenderStepped:connect(function() if player then player.Humanoid:Move(moveVector) end end)
Thanks.
Note: Game is filtering enabled, script is in ServerPlayerScripts and I want this system to be kind of like before the dawns system of forcing a player to play as a certain killer.
The issue is pretty obvious. You're moving in a set vector direction not taking into account their current lookVector. Bla, bla bla. Piece of advice, scratch what your doing, IF you're trying to replace the rig. Make a new rig/character, place it in (I think) starterplayercharacter. Look up a tutorial on custom rigs if you don't get the specifics, it's very simple.
Moving in a Vector3.new(1, 0, 0) direction, if I'm not wrong, will only move the player either right or left in a set x-axis, not in the actual direction they're facing. For example, if you're facing north, and let's say that works, if you face east.. Well let's say that's when things get "wonky".