not much else to say, but whenver i'm running in my game by holding shift and i press another input key it gets overriden. i'll send some code snippets
#inputs overriding other inputs (e.g. walking overrides running)
1 messages · Page 1 of 1 (latest)
"dumb bich" 😭 nah but I think the problem is that ur not keeping track of ur running button ur just checking is an input has stopped/started which could cause the overriding error since the game doesnt know which key is the running key or the walking key
lol
hmmm.. okay so how could i fixed this? do u have any suggestions?
Can you give the full script
it's multiple scripts. it's quite long
Walk
local walkAnim = script.Parent:FindFirstChild("WalkAnimation")
local Blokky = script.Parent
local Humanoid = Blokky:WaitForChild("Humanoid")
local Anim = Humanoid.Animator:LoadAnimation(walkAnim)
local UIS = game:GetService("UserInputService")
local Debounce = false
local Walking = false -- determines if he is walking or not, default FALSE
task.wait(1)
local keyBinds = {
[Enum.KeyCode.W] = true,
[Enum.KeyCode.A] = true,
[Enum.KeyCode.S] = true,
[Enum.KeyCode.D] = true
}
local function startWalk()
if not Walking then
Walking = true
Anim:Play(0.25)
print(Walking)
end
end
local function stopWalk()
if Walking then
Walking = false
Anim:Stop()
print(Walking)
end
end
Humanoid.Running:Connect(function(player)
if Debounce then return end
if not Walking then -- dumb bich
Debounce = true
startWalk()
else
stopWalk()
end
task.wait(0.5)
Debounce = false
while Humanoid.WalkSpeed == 0 do
task.wait()
if Walking then
Walking = false
stopWalk()
print("BlokkyWalk refreshed due to an error.")
end
-- prevents true and false from being "swapped" when playing on mobile
end
end)
Humanoid.Jumping:Connect(function(player)
if Walking then
stopWalk()
Walking = false
end
end)
Humanoid.Died:Connect(function(player)
stopWalk()
end)
Humanoid.GettingUp:Connect(function(player)
stopWalk()
end)
--[[UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if keyBinds[input.KeyCode] then
startWalk()
else
stopWalk()
end
end)
UIS.InputEnded:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if Walking then
stopWalk()
end
end)]]
ignore the commented code at the end
Run
local runAnim = script.Parent:FindFirstChild("RunAnimation")
local Blokky = script.Parent
local Humanoid = Blokky:WaitForChild("Humanoid")
local Anim = Humanoid.Animator:LoadAnimation(runAnim)
local UIS = game:GetService("UserInputService")
local Debounce = false
local Running = false
task.wait(1)
local keyBinds = {
[Enum.KeyCode.LeftShift] = true
}
local function startRun()
if not Running then
Running = true
Blokky.Humanoid.WalkSpeed = 28
Anim:Play(0.25)
print(Running)
end
end
local function stopRun()
if Running then
Running = false
Blokky.Humanoid.WalkSpeed = 16
Anim:Stop(0.25)
print(Running)
end
end
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if keyBinds[input.KeyCode] then
if not Running then
startRun()
else
stopRun()
end
end
end)
UIS.InputEnded:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if Running then
stopRun()
end
end)
** You are now Level 1! **