Hey! I recently created a Moving and Keybind Running system, And the Run animation dont really replace the walk animation, Why? Because when any animation calls the event “step” it plays a footstep sound, But like i said, The walk anim dont go away and it still print events, So the footsteps hear double, So, What is the best way to REALLY replace the animation?
Video example:
https://vimeo.com/manage/videos/978626574/privacy
(Sorry for bad quality)
My running system script:
-- Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
-- Extra Instances
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Humanoid:LoadAnimation(script.RunAnim)
local CanRun = true
local Running = false
local HasPlayedAnimation = false
local userAnimateScaleRunSuccess, userAnimateScaleRunValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserAnimateScaleRun") end)
local userAnimateScaleRun = userAnimateScaleRunSuccess and userAnimateScaleRunValue
local EventFolder = ReplicatedStorage:WaitForChild("GameEvents")
-- Tables
local Table1 = {}
-- Code
local function getRigScale()
if userAnimateScaleRun then
return Character:GetScale()
else
return 1
end
end
UserInputService.InputBegan:Connect(function(input, gpe)
if CanRun and input.KeyCode == Enum.KeyCode.LeftShift and not gpe then
Running = true
Humanoid.WalkSpeed += 8
end
end)
UserInputService.InputEnded:Connect(function(input, gpe)
if CanRun and input.KeyCode == Enum.KeyCode.LeftShift and not gpe then
Running = false
Humanoid.WalkSpeed -= 8
Animation:Stop(0.3)
HasPlayedAnimation = false
end
end)
RunService.RenderStepped:Connect(function()
local Humanoid = Character:FindFirstChild("Humanoid");
if Humanoid then
if Humanoid.MoveDirection.Magnitude == 0 then
Animation:Stop(0.3)
HasPlayedAnimation = false
elseif HasPlayedAnimation ~= true and Humanoid.MoveDirection.Magnitude > 0 and Running == true then
Animation:Play(0.5)
HasPlayedAnimation = true
end
end
end)
--[[
This script is part from Kolda Studios! Please do NOT modify any code in here.
Also pls dont rob it :p
]]