Why does animation play in studio but not in the game?

So I finally tried to test a project with my friend, but when we tried to run the run animation would not play for some reason.

Here is when I test in studio:

And here is in-game:

This is my animation so that is not the problem, and I can’t seem to find any issues in the script.

Here is the code:

local player = game:GetService("Players").LocalPlayer
local UIS = game:GetService("UserInputService")
local char = script.Parent or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local RS = game:GetService("ReplicatedStorage")

local camera = workspace.CurrentCamera

local run = false

local animation = script:WaitForChild("Animation")
local loadedAnim = hum:LoadAnimation(animation)

local blocking = char:WaitForChild("Blocking")

local stamRemote = RS:WaitForChild("Remotes"):WaitForChild("Stamina")

UIS.InputBegan:Connect(function(input, gpe)
	
	if input.KeyCode == Enum.KeyCode.LeftShift and blocking.Value == false then
		
		hum.WalkSpeed = 20
		run = true
		
		stamRemote:FireServer("startedRun")
		
		if hum.MoveDirection.Magnitude > 0 and run == true and char:WaitForChild("Stamina").Value > 1  then
			
			camera.FieldOfView = 75
			
		end	
		
		while run == true and char:WaitForChild("Stamina").Value > 1 do
			
			run = true
			wait()
			
		end
		
		hum.WalkSpeed = 10
		loadedAnim:Stop()
		run = false
		
		if run == false then
			
			hum.WalkSpeed = 10
			
		end
			
	end	
	
end)

UIS.InputEnded:Connect(function(input, gpe)

	if input.KeyCode == Enum.KeyCode.LeftShift and blocking.value == false then
		
		run = false
		
		stamRemote:FireServer("stoppedRun")
		
		hum.WalkSpeed = 10
		camera.FieldOfView = 70

	end	

end)

hum.Changed:Connect(function()
	
	if hum.MoveDirection.Magnitude > 0 and run == true and char:WaitForChild("Stamina").Value > 1 then
		
		camera.FieldOfView = 75
		
	end
	
end)

camera:GetPropertyChangedSignal("FieldOfView"):Connect(function()
	
	if camera.FieldOfView == 75 then
		
		loadedAnim:Play()
		
	elseif camera.FieldOfView == 70 then
		
		loadedAnim:Stop()
		
	end
	
end)
1 Like

Since it is your friend’s game, your friend needs to upload the animation. The work-around is to make it a group game.

2 Likes

This is not my friends game? As I mentioned I tested the game WITH a friend.