Rescripting roblox movement

One is camera relative and the other is not…

1 Like

Ok bro you can just use humanoid move

Move

void

This function causes the Humanoid to walk in the given Vector3 direction.

By default, the direction is in world terms, but If the relativeToCamera parameter is true, the direction is relative to the CFrame of the CurrentCamera. As the negative Z direction is considered “forwards” in Roblox, the following code will make the humanoid walk in the direction of the CurrentCamera.

I don’t see how using Player:Move will help with anything if it just does the same exact thing

1 Like

The Roblox player module uses player:Move(). I am really not quite sure you are arguing over something this minuet.

1 Like

I don’t understand your point

And you said Player:Move will solve their problem even though Humanoid:Move is the exact same

1 Like

I am working on a game that disables normal controls. So I have to recreate the controls from scratch.

1 Like

Doesn’t work, there’s a reason why I did it the way I did it. I appreciate the effort though!

1 Like

Humanoid:Move() moves on a xyz axis freely.
Humanoid:MoveTo() moves to a specific coordinate.

Hope this helps :>

1 Like

Also try Vector3.FromNormalId hhjjjb

1 Like

Already tried it, unfortunately it doesn’t work.

1 Like
local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer

local NormalId, FromNormalId = Enum.NormalId, Vector3.FromNormalId

local keys = {
	W = FromNormalId(NormalId.Front),
	A = FromNormalId(NormalId.Left),
	S = FromNormalId(NormalId.Back),
	D = FromNormalId(NormalId.Right)
}

UIS.InputBegan:Connect(function(input, isTyping)
	if isTyping then return end
	
	for key, normalId in pairs(keys) do
		local key = Enum.KeyCode[key]
		
		if input.KeyCode == key then
			repeat
				LocalPlayer:Move(normalId, false)
				task.wait()
			until
				not UIS:IsKeyDown(key)
		end
	end
end)
1 Like

I edited the script you provided and it seems to work fine on my end

local UserInputService = game:GetService('UserInputService')
local RunService = game:GetService('RunService')
local Players = game:GetService('Players')

local Character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild('Humanoid')

local TypingInChat = false

local camera = game.Workspace.CurrentCamera

UserInputService.InputBegan:Connect(function(Key)
	if TypingInChat then return end
	if Key.KeyCode == Enum.KeyCode.W then 
		while UserInputService:IsKeyDown(Enum.KeyCode.W) do 
			RunService.PreRender:Wait()

			if UserInputService:IsKeyDown(Enum.KeyCode.S) then

				Humanoid:Move(Vector3.new(0,0,0))

			elseif UserInputService:IsKeyDown(Enum.KeyCode.A) then

				Humanoid:Move(camera.CFrame.LookVector - camera.CFrame.RightVector)

			elseif UserInputService:IsKeyDown(Enum.KeyCode.D) then

				Humanoid:Move(camera.CFrame.LookVector - -camera.CFrame.RightVector)

			elseif UserInputService:IsKeyDown(Enum.KeyCode.A) and UserInputService:IsKeyDown(Enum.KeyCode.D) then

				Humanoid:Move(camera.CFrame.LookVector)

			else

				Humanoid:Move(camera.CFrame.LookVector)

			end
		end
	end
	
	if Key.KeyCode == Enum.KeyCode.S then 
		while UserInputService:IsKeyDown(Enum.KeyCode.S) do 
			RunService.PreRender:Wait()

			if UserInputService:IsKeyDown(Enum.KeyCode.W) then

				Humanoid:Move(Vector3.new(0,0,0))

			elseif UserInputService:IsKeyDown(Enum.KeyCode.A) then

				Humanoid:Move(-camera.CFrame.LookVector - camera.CFrame.RightVector)

			elseif UserInputService:IsKeyDown(Enum.KeyCode.D) then

				Humanoid:Move(-camera.CFrame.LookVector - -camera.CFrame.RightVector)
				
			elseif UserInputService:IsKeyDown(Enum.KeyCode.A) and UserInputService:IsKeyDown(Enum.KeyCode.D) then

				Humanoid:Move(-camera.CFrame.LookVector)

			else
				Humanoid:Move(-camera.CFrame.LookVector) 
			end
		end
	end
	
	if Key.KeyCode == Enum.KeyCode.D then 
		while UserInputService:IsKeyDown(Enum.KeyCode.D) do 
			RunService.PreRender:Wait()

			if UserInputService:IsKeyDown(Enum.KeyCode.A) then
				Humanoid:Move(camera.CFrame.LookVector)
				
			elseif UserInputService:IsKeyDown(Enum.KeyCode.W) then
				
				Humanoid:Move(camera.CFrame.LookVector - -camera.CFrame.RightVector)
				
			elseif UserInputService:IsKeyDown(Enum.KeyCode.S) then

				Humanoid:Move(-camera.CFrame.LookVector - -camera.CFrame.RightVector)
				
			else
				Humanoid:Move(camera.CFrame.RightVector)
			end
		end
	end
	
	if Key.KeyCode == Enum.KeyCode.A then 
		while UserInputService:IsKeyDown(Enum.KeyCode.A) do 
			RunService.PreRender:Wait()

			if UserInputService:IsKeyDown(Enum.KeyCode.D) then
				
				Humanoid:Move(Vector3.new(0,0,0))
				
			elseif UserInputService:IsKeyDown(Enum.KeyCode.W) then

				Humanoid:Move(camera.CFrame.LookVector - camera.CFrame.RightVector)
				
			elseif UserInputService:IsKeyDown(Enum.KeyCode.S) then

				Humanoid:Move(-camera.CFrame.LookVector - camera.CFrame.RightVector)
				
			else
				Humanoid:Move(-camera.CFrame.RightVector)
			end
		end
	end
	
	if Key.KeyCode == Enum.KeyCode.Space then 
		while UserInputService:IsKeyDown(Enum.KeyCode.Space) do 
			RunService.PreRender:Wait()

			Humanoid.Jump = true
		end
	end
end)
1 Like

@LostCoreMemories ‭‭‭tell me if this works

1 Like

Also Whyd you do Humanoid:Move(…, false)?

1 Like

,false doesn’t use camera, true uses camera.

1 Like

Tysm, works flawlessly! I didn’t realize it was more complicated than I was trying to force it to be.

1 Like

Doesn’t work probably because of the way I disable keybinds detection.

1 Like

What do you mean

Also if that doesn’t work just use this

local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer

local NormalId, FromNormalId = Enum.NormalId, Vector3.FromNormalId

local keys = {
	W = FromNormalId(NormalId.Front),
	A = FromNormalId(NormalId.Left),
	S = FromNormalId(NormalId.Back),
	D = FromNormalId(NormalId.Right)
}

UIS.InputBegan:Connect(function(input, isTyping)
	if isTyping then return end
	
	for key, normalId in pairs(keys) do
                local key = Enum.KeyCode[key]

		if input.KeyCode == key then
			local keyUp
			
			keyUp = UIS.InputEnded:Connect(function(input, isTyping)
				if isTyping then return end
				
				if input.KeyCode == key then
					keyUp:Disconnect()
					keyUp = nil
				end
			end)
			
			repeat
				LocalPlayer:Move(normalId, false)
				wait()
			until
				not keyUp
		end
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.