hi im currently suck trying to make a run animation play specifically when the person receives any sort of boost to walk speed.
secondly: everytime I use a uis the first input never registers I have to press the key for the second time for it to work correctly after
local uis = game:GetService("UserInputService")
local runservice = game:GetService("RunService")
local rs = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local chr = player.Character
local hum = chr:WaitForChild("Humanoid")
local ListOfWeapons = {
"BasicSword",
"RengokuSword",
"PlaceHolder1",
}
local SpeedOn = false
uis.InputBegan:Connect(function(input,e)
if e then return end
if input.KeyCode == Enum.KeyCode.LeftControl then
if SpeedOn then
hum.WalkSpeed = 28
end
if not SpeedOn then
hum.WalkSpeed = 16
end
SpeedOn = not SpeedOn
end
end)
runservice.Heartbeat:Connect(function()
for i,v in player.Character:GetChildren() do
if table.find(ListOfWeapons, v.Name) and v:IsA("MeshPart") then
if hum.WalkSpeed > 16 then
local WeaponRunAnim = game:GetService("ReplicatedFirst").Animations.KatanaRun
local loadRunAnim = hum:LoadAnimation(WeaponRunAnim)
loadRunAnim:Play()
else
local WeaponWalkAnim = game:GetService("ReplicatedFirst").Animations.KatanaWalk
local loadWalkAnim = hum:LoadAnimation(WeaponWalkAnim)
loadWalkAnim:Play()
end
end
end
end)