Hello,
I am currently testing with switching the character of a player. I have got setting the new character and camera correct but ran into a problem. When I switch the player’s character, the new character I switched the player to doesn’t have any animations. This means it does not play the idle, walk, jump, and all other default animations a character would usually have. The character already has the local animate script inside of it that all other characters have, yet still no animations play.
Note: The new character I give to the player is parented to the workspace.
Server Script
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local guy = workspace.Ice
game.ReplicatedStorage.Cam:FireClient(player, guy)
player.Character = guy
end)
Local Script
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
game.ReplicatedStorage.Cam.OnClientEvent:Connect(function(guy)
camera.CameraSubject = guy.Humanoid
end)
Partially, I am switching the player’s character to another character model, no different from a regular Roblox character. The camera goes to it and I can move as the new character model but walking, jumping, and all other animations do not play.
I found it being delayed because it is a server script and not a local one. So now I need to know how to make it where the local script works. I am guessing I would have to place it somewhere else, but don’t know where that would be.
I did and it doesn’t work, I also placed a print function at the beginning and that print didn’t print into the output which means the whole script together just doesn’t run. I think I need to place it in another spot but I don’t know where to place it.
Alright I fixed it. Usually you would put it in StarterCharacterScripts but when switching players it was not respawning the character so that doesn’t work. So I disabled the local script and put it in ServerScriptService. When a player goes to another character I clone the local script, insert it into the new character, and then enable the script. Also thanks for your help.