Animation just not working

I can’t get a animation to play on a player character
no errors, code snippet below.

Animation is under my account and I am playing in studio…
heres the animator
image

local Track = LocalPlayer.Character.Humanoid:WaitForChild("Animator"):LoadAnimation(script.Roll)

Track.Looped = true
Track:Play()
3 Likes

Remove the Track.Looped and wait(5) before playing the animation. Write the wait(5) at the top of the script.

3 Likes
  1. I can’t do that as I run that code upon pressing a key and then check if you have a character and a humanoid
  2. I tried and it just didn’t work also
3 Likes

Can I see the full or most of the code?

2 Likes

why not sure

local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer


UserInputService.InputBegan:Connect(function(Input, GameProccessed)
	if GameProccessed then
		return
	end
	if Input.KeyCode == Enum.KeyCode.Q then
		if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local Root = LocalPlayer.Character.HumanoidRootPart
			local Tweeninfo = TweenInfo.new(0.5)
			local Tweentable = {
				CFrame = Root.CFrame + (Root.CFrame.LookVector * 20)
			}
			
			
			
			local Tween = TweenService:Create(Root, Tweeninfo, Tweentable)
			Tween:Play()
			
			LocalPlayer.Character.Humanoid:SetAttribute("WalkSpeed", LocalPlayer.Character.Humanoid.WalkSpeed)
			LocalPlayer.Character.Humanoid.WalkSpeed = 0
			
			Tween.Completed:Wait()
			
			
			LocalPlayer.Character.Humanoid.WalkSpeed = LocalPlayer.Character.Humanoid:GetAttribute("WalkSpeed")
		end
	end
end)
3 Likes

Where’s the animation track code at?

2 Likes

shoot my bad
I sent the version without the animation (I just put it back in might not be put in right)

local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer


UserInputService.InputBegan:Connect(function(Input, GameProccessed)
	if GameProccessed then
		return
	end
	if Input.KeyCode == Enum.KeyCode.Q then
		if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local Root = LocalPlayer.Character.HumanoidRootPart
			local Tweeninfo = TweenInfo.new(0.5)
			local Tweentable = {
				CFrame = Root.CFrame + (Root.CFrame.LookVector * 20)
			}
			local Track = LocalPlayer.Character.Humanoid:WaitForChild("Animator"):LoadAnimation(script.Roll)
			
			
			local Tween = TweenService:Create(Root, Tweeninfo, Tweentable)
			Tween:Play()
			
			LocalPlayer.Character.Humanoid:SetAttribute("WalkSpeed", LocalPlayer.Character.Humanoid.WalkSpeed)
			LocalPlayer.Character.Humanoid.WalkSpeed = 0
			Track.Looped = true

                        Track:Play()
			Tween.Completed:Wait()
                        Track:Stop()
			
			
			LocalPlayer.Character.Humanoid.WalkSpeed = LocalPlayer.Character.Humanoid:GetAttribute("WalkSpeed")
		end
	end
end)
3 Likes

any ideas? im so lost on what to do

2 Likes

Weird, it works fine for me. Is the animation priority set to action?

1 Like

what’s animation priority ?
never heard of it

update
Just tested it with highest priority set
didn’t work

1 Like

holy hell
I freaking had r15 THATS WHY OMG

1 Like

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