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.
