Animation still play when I tween

Hey,

I need your help because when I tween the HumanoidRootPart the animation still does play. I want stop all animation and play my own animation but it doesnt seem work, so how can I fix this?

Here is a video for visualize the problem:

https://vimeo.com/manage/videos/503795286

and here is the script:

local rp = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local attack = rp:WaitForChild("attack")
local Attackonwall = Instance.new("Animation")
Attackonwall.AnimationId = "rbxassetid://6253916213"

    attack.OnServerEvent:Connect(function(player)
    	local character = player.Character
    	local humanoidRP = character:WaitForChild("HumanoidRootPart")
    	local Humanoid = character:WaitForChild("Humanoid")
    	local RightHand = character:WaitForChild("RightHand")

    	local sword = Instance.new("Part")
    	sword.FormFactor = "Custom"
    	sword.Shape = Enum.PartType.Block
    	sword.Material = "Neon"
    	sword.Name = "RedRayForAttack"
    	sword.CFrame = humanoidRP.CFrame * CFrame.new(0,-1,-4)
    	sword.Anchored = true
    	sword.CanCollide = false	
    	sword.Parent = game.Workspace
    	
    	sword.Touched:Connect(function(hitted)
    		local HumanoidRootPart = hitted.Parent:FindFirstChild("HumanoidRootPart")
    		local HumanoidNPC = hitted.Parent:FindFirstChild("Humanoid")
    		local EHumanoidP = HumanoidRootPart.Position
    		local AniamtionPlay = HumanoidNPC:LoadAnimation(Attackonwall)
    		local goal = {}
    		goal.CFrame = CFrame.new(game.Workspace.checkl.Position)
    		local tweenPlay = TweenService:Create(HumanoidRootPart, TweenInfo.new(0.1), goal):Play()
    		HumanoidRootPart.Anchored = true
    		AniamtionPlay:Play()
    		wait(5)
    		AniamtionPlay:Stop()
    		HumanoidRootPart.Anchored = false
    	end)
    end)
1 Like

AnimationTrack:Stop (roblox.com)
You can stop all animations using the script here:
Humanoid:GetPlayingAnimationTracks (roblox.com)

I solved this problem I wish I could delete it