-
What do you want to achieve?
I have an Idle and Use animation that is meant to be played when holding the item and using it. -
What is the issue?
For some reason, the Motor6D code of the script doesn’t work, and made the animations come out like this:
This is the intended effect:
-
What solutions have you tried so far?
I tried some solutions from the toolbox but that only made the problem worse like this:
I tried looking around the Dev Forum for some fixes for this but some of them didn’t work at all or were unrelated to this.
Here’s the code that I used for the “Script”, there’s no localscript.
--Varibles
local tool = script.Parent
local Player = tool.Parent.Parent
local Character = Player.Character
local Handle = tool:WaitForChild('Handle')
local debounce = true
local Particle = tool.heal:WaitForChild("Particle")
local Motor = Instance.new("Motor6D")
Motor.Part0 = Player.Character:WaitForChild("Right Arm")
Motor.Part1 = Handle
Motor.Name = tool.Name
Motor.Parent = Player.Character:WaitForChild("Right Arm")
local IdleAnimation = Instance.new("Animation")
IdleAnimation.AnimationId = "rbxassetid://13632867863"
local I = Character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(IdleAnimation)
local AttackAnimation = Instance.new("Animation")
AttackAnimation.AnimationId = "rbxassetid://13633194461"
local A = Character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(AttackAnimation)
--The actual Data
tool.Equipped:Connect(function()
Particle.Enabled = false
I:Play()
end)
tool.Unequipped:Connect(function()
Particle.Enabled = false
I:Stop()
A:Stop()
end)
tool.Activated:Connect(function()
local playergui = Player:FindFirstChild("PlayerGui")
local humanoid = tool.Parent:FindFirstChild('Humanoid')
if humanoid.Health >= 1*humanoid.MaxHealth then
if debounce then
debounce = false
local Cooldown = 5
game:GetService("ReplicatedStorage").RemoteEvent.Typewriter:FireClient(Player, {Text="I don't have to use this."})
script.Parent.Cooldown:FireClient(Player, Cooldown)
task.wait(5)
debounce = true
end
return
end
if humanoid and debounce then
debounce = false
A:Play()
Particle.Enabled = true
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
Humanoid.WalkSpeed = 2
Handle.Nobackpack:FireClient(Player)
task.wait(2)
Particle.Enabled = false
Humanoid.WalkSpeed = 16
humanoid.Health = humanoid.Health + 10
local debuff = tool.Parent:FindFirstChild("STATUS_EFFECT")
if debuff then
debuff:Destroy()
local shirt = tool.Parent.Torso:FindFirstChild("ScratchDecal")
if shirt then
shirt:Destroy()
end
local bleed = tool.Parent.Torso:FindFirstChild("ParticleAttachment")
if bleed then
bleed:Destroy()
end
local potiongui = playergui:FindFirstChild("PotionGui")
if potiongui then
potiongui:Destroy()
end
end
Character.Humanoid:UnequipTools()
tool:Destroy()
--wait(4)
--debounce = true
end
end)