Keybind Tool Animation Problem

This should fix it:

local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer

Player.CharacterAdded:Wait()

local Character = Player.Character

Character:WaitForChild("Humanoid")

local blockStart = script.Parent.BlockStart
local blockAnim = script.Parent.Block
local track = nil
local track2 = nil
local debounce = false
local running = false
local speed = 1

local function Stop_Anim()
	debounce = false
	if track then
		track:Stop() 
	end
	if track2 then
		track2:Stop()
	end
	track = nil
	track2 = nil
	Character.Humanoid.WalkSpeed = 16
end

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F and not debounce and not running then
		debounce = true
		track = Character.Humanoid:LoadAnimation(blockStart)
		track.Priority = Enum.AnimationPriority.Action
		track:AdjustSpeed(speed) -- 1 is equal to 100%
		track:Play()
		wait(.21)
		if not debounce then return end
		track:Stop()
		Character.Humanoid.WalkSpeed = 6
		track2 = Character.Humanoid:LoadAnimation(blockAnim)
		track2.Priority = Enum.AnimationPriority.Action
		track2.Looped = true
		track2:AdjustSpeed(speed) -- 1 is equal to 100%
		track2:Play() 
	end
end)

UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F and debounce then
		Stop_Anim()
	end
end)

Character.Humanoid.Running:Connect(function(speed)
	if speed > 0 then
		running = true
		Stop_Anim()
	else
		running = false
	end
end)

Now the script unexpectedly makes the player now run at the same speed they walk in, and the animation stops running when I start walking.

Is there anyway I could send the tool to you so I don’t have to tell you every single error that occurs?

You can publish it as a model by clicking on the model in workspace, right click, click on “Save to Roblox” enable “Allow Copying”. Then you can send me the link for the model if you want.

Do you want me to send it to you through a Roblox message?

1 Like

It’s fine, I can just go to your inventory instead.
Or maybe sending me a message would be better because I don’t know the name of the model

Okay I sent you a friend request because your messages aren’t open to public/followers.

Alright I sent the model to you

1 Like

Thanks, it says “not for sale”

Well back to asking more people to help.

If you don’t own the animation, it won’t play. Are you using your own animations?

1 Like

Yes I am, the animations are playing, but they just aren’t loading right.

Okay I do not know what in the world I did, but all of the animations work now, the blocking is the only thing that needs fixing

Edit: It’s not fixed, I have many tools that are supposed to have the same exact scripts, and for some reason only one tool works, none of the others do, that’s why the Katana was not working.

Very annoying, I do not know the issue at all. I’ve been looking around the whole studio and I do not see anything that could make this happen.

1 Like