I got this script in the toolbox free model
script works as intended but when I reset my character it just stop
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnimation = Instance.new("Animation")
RunAnimation.AnimationId = "rbxassetid://17406730342"
RAnimation = Humanoid:LoadAnimation(RunAnimation)
Running = false
function Handler(BindName, InputState)
if InputState == Enum.UserInputState.Begin and BindName == "RunBind" then
Running = true
Humanoid.WalkSpeed = 50
elseif InputState == Enum.UserInputState.End and BindName == "RunBind" then
Running = false
if RAnimation.IsPlaying then
RAnimation:Stop()
end
Humanoid.WalkSpeed = 16
end
end
Humanoid.Running:connect(function(Speed)
if Speed >= 10 and Running and not RAnimation.IsPlaying then
RAnimation:Play()
Humanoid.WalkSpeed = 30
elseif Speed >= 10 and not Running and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
elseif Speed < 10 and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end)
Humanoid.Changed:connect(function()
if Humanoid.Jump and RAnimation.IsPlaying then
RAnimation:Stop()
end
end)
game:GetService("ContextActionService"):BindAction("RunBind", Handler, true, Enum.KeyCode.LeftShift)
game.ReplicatedStorage.stopanimation.OnClientEvent:Connect(function()
script:Destroy()
end)
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnimation = Instance.new("Animation")
RunAnimation.AnimationId = "rbxassetid://17406730342"
local RAnimation = Humanoid:LoadAnimation(RunAnimation)
local Running = false
local RunBindName = "RunBind"
local function Handler(BindName, InputState)
if InputState == Enum.UserInputState.Begin and BindName == RunBindName then
Running = true
Humanoid.WalkSpeed = 50
elseif InputState == Enum.UserInputState.End and BindName == RunBindName then
Running = false
if RAnimation.IsPlaying then
RAnimation:Stop()
end
Humanoid.WalkSpeed = 16
end
end
local function OnRunningChanged(Speed)
if Speed >= 10 and Running and not RAnimation.IsPlaying then
RAnimation:Play()
Humanoid.WalkSpeed = 30
elseif Speed >= 10 and not Running and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
elseif Speed < 10 and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end
local function OnHumanoidChanged()
if Humanoid.Jump and RAnimation.IsPlaying then
RAnimation:Stop()
end
end
local function OnRunBindAction()
game:GetService("ContextActionService"):BindAction(RunBindName, Handler, true, Enum.KeyCode.LeftShift)
end
local function OnDestroy()
game:GetService("ContextActionService"):UnbindAction(RunBindName)
Humanoid.Running:Disconnect()
Humanoid.Changed:Disconnect()
end
game:GetService("ContextActionService").ActionAdded:Connect(OnRunBindAction)
Humanoid.Running:Connect(OnRunningChanged)
Humanoid.Changed:Connect(OnHumanoidChanged)
game.ReplicatedStorage.stopanimation.OnClientEvent:Connect(OnDestroy)
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnimation = Instance.new("Animation")
RunAnimation.AnimationId = "rbxassetid://17406730342"
local RAnimation = Humanoid:LoadAnimation(RunAnimation)
local Running = false
local RunBindName = "RunBind"
local RunBindAction
local function Handler(BindName, InputState)
if InputState == Enum.UserInputState.Begin and BindName == RunBindName then
Running = true
Humanoid.WalkSpeed = 50
RAnimation:Play()
elseif InputState == Enum.UserInputState.End and BindName == RunBindName then
Running = false
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end
local function OnRunBindAction()
if RunBindAction then
RunBindAction:Disconnect()
end
RunBindAction = game:GetService("ContextActionService"):BindAction(RunBindName, Handler, false, Enum.KeyCode.LeftShift)
end
local function OnRunningChanged(Speed)
if Speed >= 10 and Running and not RAnimation.IsPlaying then
RAnimation:Play()
Humanoid.WalkSpeed = 30
elseif Speed < 10 and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end
local function OnHumanoidChanged(Property)
if Property == "Jump" and RAnimation.IsPlaying then
RAnimation:Stop()
end
end
local function OnDestroy()
if RunBindAction then
RunBindAction:Disconnect()
end
Humanoid.Running:Disconnect()
Humanoid.Changed:Disconnect()
end
game:GetService("ContextActionService").ActionAdded:Connect(OnRunBindAction)
Humanoid.Running:Connect(OnRunningChanged)
Humanoid.Changed:Connect(OnHumanoidChanged)
game.ReplicatedStorage.stopanimation.OnClientEvent:Connect(OnDestroy)
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnimation = Instance.new("Animation")
RunAnimation.AnimationId = "rbxassetid://17406730342"
local RAnimation = Humanoid:LoadAnimation(RunAnimation)
local Running = false
local RunBindName = "RunBind"
local RunBindAction
local function Handler(BindName, InputState)
if InputState == Enum.UserInputState.Begin and BindName == RunBindName then
Running = true
Humanoid.WalkSpeed = 50
if not RAnimation.IsPlaying then
RAnimation:Play()
end
elseif InputState == Enum.UserInputState.End and BindName == RunBindName then
Running = false
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end
local function OnRunBindAction()
if RunBindAction then
RunBindAction:Disconnect()
end
RunBindAction = game:GetService("ContextActionService"):BindAction(RunBindName, Handler, false, Enum.KeyCode.LeftShift)
end
local function OnRunningChanged(Speed)
if Speed >= 10 and Running and not RAnimation.IsPlaying then
RAnimation:Play()
Humanoid.WalkSpeed = 30
elseif Speed < 10 and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end
local function OnHumanoidChanged(Property)
if Property == "Jump" and RAnimation.IsPlaying then
RAnimation:Stop()
end
end
local function OnDestroy()
if RunBindAction then
RunBindAction:Disconnect()
end
Humanoid.Running:Disconnect()
Humanoid.Changed:Disconnect()
end
game:GetService("ContextActionService").ActionAdded:Connect(OnRunBindAction)
Humanoid.Running:Connect(OnRunningChanged)
Humanoid.Changed:Connect(OnHumanoidChanged)
game.ReplicatedStorage.stopanimation.OnClientEvent:Connect(OnDestroy)