#Anyone know why my animation is not working when I left click?

1 messages · Page 1 of 1 (latest)

latent pendant
#

Here is my script : local tool = script.Parent
local holding = false

local punch = Instance.new("Animation")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")
punch.AnimationId = "rbxassetid://95364017272840"
local punchPlay = animator:LoadAnimation(punch)
tool.Equipped:Connect(function()
print("Tool equipped")
end)

tool.Unequipped:Connect(function()
print("Tool unequipped")
end)

tool.Activated:Connect(function()
print("Tool activated")
punchPlay:Play()

end

end)

shut junco
#

beacuse tool.Equipped and tool.Unequipped dosent work

#

use `tool.AncestryChanged:Connect(function()

end)`

#

then check if the parent is the backpack or the character to detect if its equipped or not

latent pendant
#

I don't understand

#

Like this?

sly creekBOT
#

studio** You are now Level 4! **studio

latent pendant
#

local tool = script.Parent
local holding = false

local punch = Instance.new("Animation")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")
punch.AnimationId = "rbxassetid://95364017272840"
local punchPlay = animator:LoadAnimation(punch)

tool.AncestryChanged:Connect(function()
if tool.Parent == player.Backpack then
print("Tool equipped")
end
end)

#

@shut junco