In the video below, im touching a brick which is supposed to play a specific animation. The problem is that when I do so, the animation does play but sometimes not as expected. When I first touch the brick, the animation is played but barely. The animation is supposed to like the character taking out his gun and shooting it but it’s just the character barley reaching for it. I dont know why it causes this, I didn’t even make an animation ressembling something like that.
Here is my code located in a server script as a child to the brick.:
local db = false
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and not db then
db = true
local animator = hit.Parent:FindFirstChild("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = hit.Parent:WaitForChild("Humanoid")
end
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://80055688272722"
anim.Parent = animator
local track = animator:LoadAnimation(anim)
track:Play()
task.wait(2)
db = false
end
end)