Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to use the StarterCharacter to change the player's character?

Asked by 3 years ago

Basically, I have a script that changes the StarterCharacter but it doesn't actually change it

script.Parent.MouseButton1Click:Connect(function()
    local OldPlayerPos = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
    local CharClone = game.Workspace.CharactersFolder[game.Workspace.Camera.CameraSubject.CharacterName.Value]:Clone()
    game.StarterPlayer.StarterCharacter:Destroy()
    CharClone.Name = "StarterCharacter"
    CharClone.Parent = game.StarterPlayer
    game.ReplicatedStorage.LoadCharacterEvent:FireServer()
    game.Workspace.Camera.CFrame = game.ReplicatedStorage.OldCamCFrame.Value
    game.Workspace.Camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    game.Workspace.Camera.CameraType = Enum.CameraType.Custom   
end)

and heres the server script that loads the character:

game.ReplicatedStorage.LoadCharacterEvent.OnServerEvent:Connect(function(Player)
    Player.Character:Destroy()
    Player:LoadCharacter()
end)

2 answers

Log in to vote
1
Answered by 3 years ago

From my experience ,I'm pretty sure it already does it for you. Just insert the character you want to use named "StarterCharacter" (must be rigged correctly), and insert a humanoid named "StarterHumanoid"

Hope this helps.

Ad
Log in to vote
0
Answered by
Antelear 185
3 years ago

Just find/rig your own character (for instance an NPC, and delete any scripts/unneeded values inside it) and then name it "StarterCharacter". When you do that, make sure it has a HUMANOID and if it does name it "StarterHumanoid", if not, make a new one and name it that too.

When you're done, just add it to "StarterPlayer" which should be in explorer. If that doesn't work, please lmk so I can help you (let me know) <3

Answer this question