I made this simple animation script for a custom rigged model, and some of the weirdest things are happening with it. The script itself goes inside the model, which goes inside the character. If the script is a LocalScript, all the animations work, however the animations won't play for other clients. If it is a regular Script, then it plays for other clients sometimes, and a lot of times doesn't even play some of the animations.

wait()
state = {Enum.HumanoidStateType.Running,
		Enum.HumanoidStateType.RunningNoPhysics,
		Enum.HumanoidStateType.Jumping,
		Enum.HumanoidStateType.Freefall,
		Enum.HumanoidStateType.Landed
}
animations = {"604617490", -- Running/Walking
			"604935959", -- Idle
			"604942656", -- Moving Jump
			"604952164", -- Idle Jump
			"", -- Freefalling
			"" -- Landing
			 }

CurrentState = ""
Animation = ""
canPlay = true

Player = game.Players.LocalPlayer

function playAnimation(Source,animation,player)
	if canPlay then
		local player = script.Parent.Parent
		canPlay = false
		local animTrack = Source.Humanoid:LoadAnimation(animation) -- Load animation into Humanoid
		canPlay = true
		animTrack:Play() -- Start the animation
	end
end

local animation = Instance.new("Animation")
	
local character = Player.Character
local humanoid = character.Humanoid

humanoid.StateChanged:connect(function(old,new)
	if CurrentState == "Running" and new == state[3] then -- Moving to Jump
		CurrentState = "Jump"
		
		if animations[3] ~= "" then
			animation.AnimationId = "http://www.roblox.com/Asset?ID="..animations[3]
			playAnimation(character,animation)
		end
	end
	
	if CurrentState == "Idle" and new == state[3] then -- Idle to Jump
		CurrentState = "Jump"
		
		if animations[4] ~= "" then
			animation.AnimationId = "http://www.roblox.com/Asset?ID="..animations[4]
			playAnimation(character,animation)
		end
	end
	
	if new == state[4] then
		CurrentState = "Falling"
		
		if animations[5] ~= "" then
			animation.AnimationId = "http://www.roblox.com/Asset?ID="..animations[5]
			playAnimation(character,animation)
		end
	end
	
	if new == state[5] then
		CurrentState = "Landed"
		
		if animations[6] ~= "" then
			animation.AnimationId = "http://www.roblox.com/Asset?ID="..animations[6]
			playAnimation(character,animation)
		end
	end
	
end)
	
humanoid.Running:connect(function(state)
	if state > 3 then
		if CurrentState ~= "Running" then
			CurrentState = "Running"
			
			humanoid.HipHeight = 1
			animation.AnimationId = "http://www.roblox.com/Asset?ID="..animations[1]
			playAnimation(character,animation)
		end
	else
		if CurrentState ~= "Idle" then
			CurrentState = "Idle"
			
			humanoid.HipHeight = 0
			animation.AnimationId = "http://www.roblox.com/Asset?ID="..animations[2]
			playAnimation(character,animation)
		end
	end
end)


2 comments

0

I think if the game is FE, Roblox will block custom animation but allow their preset ones

0

But I've seen many games with custom animations with FE on.