Animate script doesn't work for custom characters

So I’m trying to make a game with a character loader as I will be using custom characters and I’m using the default Animate script. For some reason, it only seems to work on your client and you can’t see anyone else’s animations.

I do not want to add Animate scripts to every character model. While I do know that would work, it’s highly inefficient and I want to manually assign it on character creation for flexibility.

This is the ModuleScript that handles character creation. The Animate script is the default one provided by Roblox.

local Mod = {}

local OverrideTest = false

local DefaultCharacterStorage = game.ServerStorage.Survivors:GetChildren()

function Mod.LoadPlr(Player, SpawnPos, CharacterOverride)
	if not Player or not Player:IsA("Player") then
		return
	end
	local success, player = pcall(function()
		local Char
		if CharacterOverride then
			Char = CharacterOverride:Clone()
		else
			Char = DefaultCharacterStorage[math.random(1, #DefaultCharacterStorage)]:Clone()
		end
		if OverrideTest then return Player:LoadCharacter():PivotTo(workspace.Lobby.Spawn.CFrame) end -- purposefully bomb the script so it loads fallback
		Char.Name = Player.Name
		
		local Animate = script.AnimateScript:Clone()
		Animate.Name = "Animate"
		Animate.Parent = Char
		Animate.Enabled = true
		Player.Character = Char
		
		Char.Parent = workspace
		if SpawnPos then
			Char:PivotTo(SpawnPos.CFrame)
		end
		return Char
	end)
	if not success then
		warn("Issue loading player "..Player.Name)
		Player:LoadCharacter() -- load default avatar as fallback
		return
	end
end

return Mod
4 Likes

I’ve tried a few more approaches after this, nothing worked. Even tried switching to a server script. That approach works but makes it reliant on ping which looks really bad :confused:.

4 Likes

Bumping this post so someone better than me can see it.

I don’t know much about animation, but I have touched on it a bit before. If your StarterCharacter has another Animate localscript, then it might cause problems (I assume). I would doubt that this is the case though since you are using a custom character model.

2 Likes

They unfortunately do not have Animate scripts by default.

2 Likes

Hiya. I am not sure about your existing system. But mightn’t it be possible to instead put your rig/char in starterCharacterScripts (Or StarterPlayer, I don’t quite remember) and name it StarterCharacter. This should automatically make it the playercharacter of any player who joins. I don’t know if this is relevant. But may help.

Nevermind, Scratch that. I think the problem is you arent :Destroy()ing the old player character before you spawn the new one.

1 Like

maybe..

Char.Parent = workspace

for _, part in ipairs(Char:GetDescendants()) do
    if part:IsA("BasePart") then
        part:SetNetworkOwner(Player)
    end
end

Looking over some old scripts here, looks like I was trying to do this too and settled on morphing to them with a proxy prompt. It has full control of the animations.. Something to play around with anyways.. Wolfman.rbxm (70.6 KB) I only use R15, so not sure if that will be any help.
(this is drag and drop)

If this works I’m going to scream

EDIT: nope doesn’t work

This kinda solves it, but it defaulted the Animate script?? I guess I just need to delete the one already existing and replace it.

Figured you were using r6, but you can see the steps. You would have to set that r6 up just like I did that r15.. I think Fox_Lord88 is right, but maybe not the order of that. Move everything over set owner then delete the old one. You can see in that prompt script I was setting that up and commented it off.

The animations are still bugged :C

I just don’t know how to help here, I just don’t work with them r6 bodies. I’m sure someone knows just what to do. There are many examples here on the forums if you look around. I just can’t say for sure they work and don’t want to lead you down the wrong path..

I did it. I fucking did it.

The solution was so dumb that I couldn’t even believe it at first. But anyway, let me tell you the solution!

1. Change the network ownership section so only the HumanoidRootPart is owned by the player
2. Insert an Animator instance into the Humanoid
3. Add a task.wait() after the Character gets parented to the server, then enable the Animate script so the Humanoid can load properly

1 Like

Why didn’t you just copy and paste Roblox’s default animation script and then change the animations inside it?

…thats literally what i did sonion rings

1 Like

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