Does applying an animation to a Humanoid not work on mobile users?

So I’ve got a script that will make a Humanoid play an animation. This works 100% on desktop. But I just tried on mobile, and the animation doesn’t seem to display. Any ideas?

bump
//////////////////////////////////////

Is it possible for us to see the script that would be running this animation. As well as a possible video of what it appears like on mobile? There is only a little bit of information, and more might make it helpful to find a solution

Yes sir, I’ll post the scripts below. I don’t have a way to capture though, it’s on mobile. It would be quite difficult to somehow capture and upload if at all possible on my end.

But a description, basically the script will remove your backpack until the effect is over. It’s a tool that throws a “Grenade” projectile, and any affected Humanoids in the blast radius will have a dance animation applied to them for a few seconds. Afterwards they return back to normal and their backpack is returned. The animation doesn’t seem to work on mobile though. There is a server script for the throw, but not gonna post that. Has nothing to do with the actual animation part. It just deals with the projectile. And the client script is just UI mainly.

But here is the grenade script

Server script:

local GameServices = {
	Players = game:GetService("Players"),
	Workspace = game:GetService("Workspace"),
	Lighting = game:GetService("Lighting"),
	ReplicatedStorage = game:GetService("ReplicatedStorage"),
	ReplicatedFirst = game:GetService("ReplicatedFirst"),
	ServerStorage = game:GetService("ServerStorage"),
	ServerScriptService = game:GetService("ServerScriptService"),
	StarterGui = game:GetService("StarterGui"),
	Teams = game:GetService("Teams"),
	Pathfinding = game:GetService("PathfindingService"),
	RunService = game:GetService("RunService"),
	--
	ContextActionService = game:GetService("ContextActionService"),
	TweenService = game:GetService("TweenService"),
	Debris = game:GetService("Debris"),
	InsertService = game:GetService("InsertService")
}

local Grenade = script.Parent;
local GrenadeNoise = script:WaitForChild("GrenadeNoise");
local Sparkles = Grenade:WaitForChild("Sparkles");
local Player = script:WaitForChild("Creator",10).Value;

function IsTeamMate(Player1, Player2)
	return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end

function IsInTable(Table, Value)
	-- Function Written by: @TakeoHonorable --
	for i, v in pairs(Table) do
		if v == Value then
			return true
		end
	end
	return false
end

function CheckEnemyNearby(Part, Range)
	-- Function Written by: @EunhaYiren --
	local NegativeRegion = (Part.CFrame.p - Vector3.new(Range,Range,Range))
	local PositiveRegion = (Part.CFrame.p + Vector3.new(Range,Range,Range))
	local Region = Region3.new(NegativeRegion,PositiveRegion)
	local Parts = GameServices.Workspace:FindPartsInRegion3WithIgnoreList(Region,{Part},math.huge)
	local Hums = {}
	for Index,hit in pairs(Parts) do
		if hit and hit.Parent then
			local Hum = hit.Parent:FindFirstChildOfClass("Humanoid")
			if Hum and Hum.Health > 0 and not IsInTable(Hums,Hum) then
				Hums[#Hums+1]=Hum
			end
		end
	end
	local Num = 0
	for Index,Hum in pairs(Hums) do
		Num = Num + 1
	end
	if Num > 0 then
		return true, Hums
	end
	return false, {}
end


GrenadeNoise.Parent = Grenade;
GrenadeNoise:Play();

local Duration = 2.2

Sparkles.Enabled = true

local MinColor, MaxColor = 0, 2500

while Duration > 0 do 
	tick()
	Duration = Duration - wait()
	wait()
	Sparkles.SparkleColor = Color3.new(math.random(MinColor, MaxColor), math.random(MinColor, MaxColor), math.random(MinColor, MaxColor))
end

local IsThereEnemy, Humanoids
pcall(function()
	IsThereEnemy, Humanoids = CheckEnemyNearby(Grenade, 20)
	-- Error should be stopped.
end)

if IsThereEnemy then
	for i =1,#Humanoids do
		local DanceScript = script:WaitForChild("DanceScript"):Clone()
		DanceScript.Parent = GameServices.ServerScriptService
		DanceScript:WaitForChild("Character",10).Value = Humanoids[i].Parent
		DanceScript.Disabled = false
	end
end

if GrenadeNoise and GrenadeNoise.Parent and GrenadeNoise.IsPlaying then GrenadeNoise:Stop(); GrenadeNoise:Destroy(); GrenadeNoise = nil; end

local function Explosion()
	local Explos = Instance.new("Explosion", workspace)
	Explos.BlastRadius = 0
	Explos.BlastPressure = 0
	Explos.Position = Grenade.Position
	local ExSound = script:WaitForChild("Explosive"):Clone()
	ExSound.PlayOnRemove = true
	ExSound.Parent = Grenade 
end

pcall(function() Explosion() end)
if Grenade then Grenade:Destroy(); Grenade = nil; end


Dance script:

local GameServices = {
	Players = game:GetService("Players"),
	Workspace = game:GetService("Workspace"),
	Lighting = game:GetService("Lighting"),
	ReplicatedStorage = game:GetService("ReplicatedStorage"),
	ReplicatedFirst = game:GetService("ReplicatedFirst"),
	ServerStorage = game:GetService("ServerStorage"),
	ServerScriptService = game:GetService("ServerScriptService"),
	StarterGui = game:GetService("StarterGui"),
	Teams = game:GetService("Teams"),
	Pathfinding = game:GetService("PathfindingService"),
	RunService = game:GetService("RunService"),
	--
	ContextActionService = game:GetService("ContextActionService"),
	TweenService = game:GetService("TweenService"),
	Debris = game:GetService("Debris"),
	InsertService = game:GetService("InsertService")
}

local Deletables, Plays, Connects = {}, {}, {}
local function Clean()
	if #Connects > 0 then
		for i = 1, #Connects do
			if Connects[i] then Connects[i]:Disconnect(); Connects[i] = nil; end
		end
		Connects = {}
	end
	if #Plays > 0 then
		for i = 1,#Plays do
			if Plays[i] then Plays[i]:Stop(); Plays[i] = nil; end
		end
		Plays = {}
	end
	if #Deletables > 0 then
		for i = 1,#Deletables do
			if Deletables[i] ~= nil then Deletables[i]:Destroy(); Deletables[i] = nil; end
		end
		Deletables = {}
	end
	script:Destroy()
end

local Character = script:WaitForChild("Character",10).Value
local DanceNoise = script:WaitForChild("DanceNoise")
local Animations = script:WaitForChild("Animations")

if not Character or not Character.Parent then
	Clean()
	return
end

local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid or not Humanoid.Parent or Humanoid.Health <= 0 then
	Clean()
	return
end

local Root = Character:FindFirstChild("HumanoidRootPart") or Character:FindFirstChild("Head")
if not Root or not Root.Parent then
	Clean()
	return
end

local Player = GameServices.Players:GetPlayerFromCharacter(Character)

Humanoid.WalkSpeed = 0
Connects[#Connects+1] = Humanoid.Changed:Connect(function()
	Humanoid.WalkSpeed = 0
end)

local function TurnBackpack(Bool)
	if Bool then
		local Enable = script:WaitForChild("EnableBackpack"):Clone()
		pcall(function() Enable.Parent = Player:WaitForChild("PlayerGui") Enable.Disabled = false end)
		GameServices.Debris:AddItem(Enable, 3)
	elseif not Bool then
		local Disable = script:WaitForChild("DisableBackpack"):Clone()
		pcall(function() Disable.Parent = Player:WaitForChild("PlayerGui") Disable.Disabled = false end)
		GameServices.Debris:AddItem(Disable, 3)
	end
end

local function Dance()
	pcall(function() Humanoid:UnequipTools() TurnBackpack(false) end)
	local noise = DanceNoise:Clone()
	noise.Parent = Root
	noise:Play()
	Plays[#Plays+1] = noise
	Deletables[#Deletables+1] = noise
	local Anim, PlayAnim = Animations:FindFirstChild("DanceAnimation"..Humanoid.RigType.Name,5), nil
	if Anim then
		PlayAnim = Humanoid:LoadAnimation(Anim)
		if PlayAnim then PlayAnim:Play(); Plays[#Plays+1]=PlayAnim; end
	end
	wait(5.5)
	if Character and Character.Parent then
		if noise and noise.Parent then noise:Stop(); noise:Destroy(); noise = nil; end
		wait(1)
		if PlayAnim then PlayAnim:Stop(); PlayAnim = nil; end
		for i = 1,#Connects do
			if Connects[i] then
				Connects[i]:Disconnect();
				Connects[i] = nil;
			end
		end
		Humanoid.WalkSpeed = 16
	else
		pcall(function() TurnBackpack(true) end)  
		Clean()
		return
	end
end

Dance()

pcall(function()
	TurnBackpack(true)
end)

Clean()

I heavily doubt it’s a compatibility issue.
I’ve had some issues with animations not loading in the past and it seems like its almost always just a roblox or internet related issue.

I don’t see anything wrong with your code that would be causing this behavior directly, though it’s possible I missed something.
I do suggest loading the animation to Humanoid.Animator rather than straight to the humanoid, as that method is now deprecated.

1 Like

Anyone on this thread able to do me a favor and test it yourself on mobile? I’ll put the item in the starter pack. I will say this, my phone is utter crap and barely runs even the smallest maps very well.

Basically all you have to do is throw the grenade at a humanoid (which will be next to your spawn) and see if he starts dancing. If he doesn’t dance but you hear a music play, then it doesn’t work on mobile for some reason I guess)

You can also throw it on yourself. If anyone is willing, let me know. Thanks.