Animation Tool Keybinds

Sadly it is still not working,

Can you show output? (30 character limit)

I have checked output myself and there is nothing of interest (except a weld issue but I don’t think that would change anything…?)

image

code start

-- Tool References
local Tool = script.Parent
local Player = script.Parent.Parent.Parent
local Model = nil

-- When the tool is unequipped
Tool.Unequipped:connect(function()

	-- Define Character
	local Character = Player.Character
	
	-- Create the welded model
	Model = Instance.new("Model", Character)	
	Model.Name = Tool.Name.."Weld"

	
	-- Weld all parts to the handle
	local Handle1 = Tool.Handle1:Clone()
	Handle1.Name = "Part"
	Handle1.CanCollide = false
	Handle1.Parent = Model
	for _,Item in pairs(Tool:GetChildren()) do
		if Item.ClassName == "Part" or Item.ClassName == "UnionOperation" or Item.ClassName == "MeshPart" then
			if Item.Name ~= "Handle1" then
				local Part = Item:Clone()
				local Weld = Instance.new("Weld")
				Weld.Parent = Part
				Weld.Part0 = Part
				Weld.Part1 = Handle1
				Weld.C0 = Part.CFrame:inverse() * Handle1.CFrame
				Part.Parent = Model
				Part.CanCollide = false

			end
		end
	end
	
	-- CFrame model to side	
	local Weld = Instance.new("Weld")
	Weld.Parent = Handle1
	Weld.Part0 = Handle1
	Weld.Part1 = Player.Character.Torso
	Weld.C0 = CFrame.new(-0.6, 0, .6) * CFrame.fromEulerAnglesXYZ(-90, math.rad(-90), math.rad(90))		
end)

-- When the tool is equipped
Tool.Equipped:connect(function()
wait()
		Model:Destroy()

	
end)

code end

Also, you can’t change workspace value from localscript, can you test your script without this? if script.parent.parent.parent.parent.Lighting.gunvalues.l85a2 == true then

Sorry, I’m confused as to what you are talking about. Can you specify which script? There are multiple.

Can you just remove
while true do
wait (0.5)
if script.parent.parent.parent.parent.Lighting.gunvalues.l85a2 == true then
from first script?

The == indicates that it is not changing it but is detecting if it is true.
I’m guessing you’re telling me to remove the if statement for testing? (This was one of the main features it was meant to have)

I will remove those parts and post back.

Update: removing those parts changed absolutely nothing

I know, but from second script I read you want to change value, etc. and I don’t have any idea, sorry.

local Character = Player.Character
local CharAnimation
game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.C and not gameProcessedEvent then 
  animation("4853287887")
elseif inputObject.KeyCode == Enum.KeyCode.N and not gameProcessedEvent then 
  animation("4855232288")
end
end)
function animation(AnimationID)
  if Character then
    local UseLessAnimation = Character:FindFirstChild("AnimationCharacter")
    if CharAnimation then
      CharAnimation:Stop()
    end
    if UseLessAnimation then
      if UseLessAnimation.AnimationId == "rbxassetid://"..AnimationID then
        UseLessAnimation:Destroy()
        return
      end
      UseLessAnimation:Destroy()
    end
    local Animation =Instance.new("Animation",Character)
    Animation.Name= "AnimationCharacter"
    Animation.AnimationId = "rbxassetid://"..AnimationID
    CharAnimation= Character.Humanoid:LoadAnimation(Animation)
    CharAnimation:Play()
  end
end


**This LocalScript actually works and is what I modeled that other local script off of**
**It may be more useful**

Just for the sake of readability, I would suggest putting your code like this. Inline you surround your code with “`” and multi-line you add “```” above and below your code. It looks like this:

“```”

Paste code here
print("It has syntax highlighting too")
.
.
.

“```”

You can also highlight your code and select the </> button in the forum text editor to apply it if you don’t like to type out the “```”.