#Start Animation when player has equiped a tool and clicked.
6 messages · Page 1 of 1 (latest)
i got sm: like an script that isnt working
local tool = script.Parent
local player = game.Players.LocalPlayer
local animation = tool:WaitForChild("Animations"):WaitForChild("Trivela")
local function playAnimation()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
if not humanoid:FindFirstChild("Animator") then
local animator = Instance.new("Animator")
animator.Parent = humanoid
end
local animationTrack = humanoid:LoadAnimation(animation)
animationTrack.Priority = Enum.AnimationPriority.Action
animationTrack:Play()
end
tool.Equipped:Connect(function()
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.Q then
playAnimation()
end
end)
end)
the script
idk why it isnt working
fixed it myself