Issues with animation

hello!

i am creating a replica of the workspace inside a screen, i am having problems displaying tools, due to multiple issues: tools not working as usual (manual welding, animations, etc). though this isnt my main problem, since i’ve gotten most of that working. i am having problems with the animation, since it keeps blending with the walk animation, i’ve tried changing the animationpriority, yet it still causes this issue. (video below, along with code)

local function addTrack(humanoid, anim, screenName, animationPriority)
	if addTrackCooldown then return end
	local animTrack = anim
	local key = humanoid.Parent.Name .. animTrack.Name .. screenName
	if not animTracks[key.."Printed"] then
		animTracks[key.."Printed"] = true
		local Track = addTrack(humanoid, anim, screenName, animationPriority)
		print(Track.Priority)
	end
	if animTracks[key] then return animTracks[key] end

	local track : AnimationTrack = humanoid:FindFirstChildOfClass("Animator"):LoadAnimation(animTrack)
	if tonumber(animationPriority) then
		if animationPriority == 1 then
			track.Priority = Enum.AnimationPriority.Action
		elseif animationPriority == 2 then
			track.Priority = Enum.AnimationPriority.Action2
		elseif animationPriority == 3 then
			track.Priority = Enum.AnimationPriority.Action3
		elseif animationPriority == 4 then
			track.Priority = Enum.AnimationPriority.Action4
			track:AdjustWeight(0.5, 0.2)
		end
	elseif tostring(animationPriority) then
		if animationPriority == "M" then
			track.Priority = Enum.AnimationPriority.Movement
		elseif animationPriority == "I" then
			track.Priority = Enum.AnimationPriority.Idle
		end
	end
	
	animTracks[key] = track

	track:Stop()

	return track
end
local function addTool(tool, viewport, player)
	local worldModel = viewport:WaitForChild("ViewportFrame"):WaitForChild("WorldModel")
	
	local clonedPlayerChar = worldModel:FindFirstChild(player.UserId)
	
	local weld = Instance.new("WeldConstraint", tool:FindFirstChild("Handle"))
	weld.Part0 = tool.Handle
	weld.Part1 = clonedPlayerChar:FindFirstChild("RightHand")
	weld.Name = "HandWeldViewport"
	
	local newToolTrack = addTrack(clonedPlayerChar:FindFirstChild("Humanoid"), script.holdAnimation, viewport.Name, 4)
	newToolTrack:Play()
	
	tool:Clone().Parent = clonedPlayerChar
end
local idleTrack = addTrack(clonedHumanoid, character:WaitForChild("Animate"):WaitForChild("idle"):WaitForChild("Animation1"), viewport.Name, "I")
							local runTrack = addTrack(clonedHumanoid, character:WaitForChild("Animate"):WaitForChild("run"):WaitForChild("RunAnim"), viewport.Name, 1)
							local walkTrack = addTrack(clonedHumanoid, character:WaitForChild("Animate"):WaitForChild("walk"):WaitForChild("WalkAnim"), "M")
							local jumpTrack = addTrack(clonedHumanoid, character:WaitForChild("Animate"):WaitForChild("jump"):WaitForChild("JumpAnim"), viewport.Name, "M")
							local fallTrack = addTrack(clonedHumanoid, character:WaitForChild("Animate"):WaitForChild("fall"):WaitForChild("FallAnim"), viewport.Name, "M")

Give this a try: WorldModel | Documentation - Roblox Creator Hub

hi! thank you for the reponse, i figured out it was because i didnt animate all the arms parts. thank you though!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.