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
@40kq 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.