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

How can I refresh my character so that it respawns with StarterCharacter in StarterPlayer?

Asked by
Zologo 37
6 years ago

Alright so I have 3 character models in my server storage (naruto, luffy and goku).

I want to make a Image Button that when you click it you get ''morphed'' into naruto and then closes the GUI.

This is my code so far.

local naruto = game.ServerStorage:WaitForChild('Naruto')
local narutoc = naruto:Clone()
local replicatedStorage = game:GetService("ReplicatedStorage")
local respawnEvent = replicatedStorage:WaitForChild("Respawn_Plr")


script.Parent.MouseButton1Click:connect(function()
    narutoc.Name = 'StarterCharacter'
    narutoc.Parent = game.StarterPlayer
    respawnEvent:FireServer()
    script.Parent.Parent : destroy()
end)

So far my script makes a copy of the naruto model from ServerStorage then renames it StarterCharacter and places it under game.StarterPlayer, then it respawns the character and closes the GUI.

The problem is that even though the character respawns it doesnt morph as Naruto can you please help me?

0
If you're going to use double quotes for strings, stick with it. Don't switch. User#24403 69 — 6y
0
why not just make them spawn as the startercharacter? magentacrasyguy -7 — 6y
0
cuz there are multiple characters, if they want to switch they cant Zologo 37 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You won't be able to accomplish this by modifying the StarterCharacter. This would A) have to be done on the server and B) would affect every other player in the game who happens to spawn at the same time as the player changing their character.

Instead, you'll have to actually implement a "morph" script that replaces the default character's parts, clothing, and attachments with the ones for the desired character.

As a starting point, look at the documentation for Humanoid, which details methods that you can use to change a character's appearance:

  • AddAccessory()
  • RemoveAccessories()
  • ReplaceBodyPartR15()

You can also create, remove, and change the clothing inside a character.

0
Alright, thank you very much i'll look at the documentation for Humanoid Zologo 37 — 6y
Ad

Answer this question