So right now I have a character select system, and once the player chooses a character they morph into that specific player (the way this is done is by putting the model of that specific character in StarterPlayer with the name “StarterCharacter”, I think you see why this is a problem)
What this does is basically, if one player chooses a character, every other subsequent player will have that character too, I’ve searched several forums from doing it with player.Character = model (this was extremely glitchy as the animations wouldnt load and the camera would be buggy) to applying humanoiddescriptions (which is irrelevant to me because im using custom characters, not a specific player’s character)
Any help would be appreciated!
set Player.Character to a clone of whatever character they choose
Already did this, the camera wont get focused on the character (which isnt a big problem since i can set the camerasubject) but the animations wont load and its overall pretty buggy
do the character models have an animate script in them?
1 Like
If you’re working with vanilla Humanoid characters, then yes, manually setting the Character property will have unintended consequences that requires workarounds. I would recommend using Player:LoadCharacterWithHumanoidDescription() or Humanoid:ApplyDescription() instead. There is an entire article about creating your own HumanoidDescription here:
1 Like
I’ve written up this LocalScript you can paste into StarterPlayerScripts that will fix the CameraSubject and animating issues if you do decide to manually set the Character property:
--!strict
local Players = game:GetService("Players")
local Player: Player = Players.LocalPlayer
local Camera: Camera = workspace.CurrentCamera
local function apply(character: Model): ()
-- Wait until the character is in the workspace
while not character:IsDescendantOf(workspace) do
character.AncestryChanged:Wait()
end
-- Wait for the Humanoid (on Immediate signals,
-- Humanoid may not exist after CharacterAdded)
local humanoid: Instance? = character:WaitForChild("Humanoid", 3)
-- Check if the Character is a custom one by
-- checking if the CameraSubject is different
-- since Roblox automatically does this for us
if humanoid ~= nil and humanoid:IsA("Humanoid") and Camera.CameraSubject ~= humanoid then
-- Apply the CameraSubject to the new Humanoid
Camera.CameraSubject = humanoid
-- If it contains an animate script, simply
-- re-enabling it will run the Animate script
-- as expected
local animate: Instance? = character:FindFirstChild("Animate")
if animate ~= nil and animate:IsA("LocalScript") then
animate.Enabled = false
animate.Enabled = true
end
end
end
-- Listen for CharacterAdded
Player.CharacterAdded:Connect(apply)
-- In case this LocalScript runs late, apply it
-- in case the server already applied a custom character
if Player.Character ~= nil then
task.spawn(apply, Player.Character)
end
1 Like
Wow i sure as hell look dumb now
Yeah uhh that was the problem i was overcomplicating myself thanks a ton
Thanks a ton for the help too, I didnt really need the script just didnt realise that the character model needed to have an animate script inside it, I appreciate the effort a lot though