Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

So how do i make it so that when the player clicks on a class gui and they spawn in as that class?

So the title is unnecessarily long but basically I'm making an RPG game and I got the classic class picker and I want when the player clicks on the class that they want to be like archer, mage you know the classic but I don't know how to that I tried adding an archer model to the starter player then changing that models name to starter character but It didn't work. PLEASE HELP. Thank you.

1 answer

✓ Accepted answer

Simple, you create a character model and place it in a storage thats replicated on cilent and server. Then upon a function, the player.Character value gets set to the new character model, thats placed in workspace.

TIP: put the humanoid into the new model AFTER the plasyer's character has ben set to it, or the .Died event might trigger and glitch.

EXAMPLE: (this might not work as intended, obviously needs to be changed according to your game so it works.)

local function setPlayerCharacter(player,model)

local clonedModel = game.ReplicatedStorage.CharacterModel:Clone() -- clone new char model
local oldHumanoid = clonedModel:waitForChild("Humanoid") -- wait for humanoid
oldHumanoid.Parent = game.ReplicatedStorage -- temporaraly set humanoid to a placeholder
clonedModel.Parent = workspace -- put character in workspace
clonedModel.Name = player.Name -- name the model accordingly
player.Character = clonedModel  -- set player's character
oldHumanoid.Parent = clonedModel -- put in new humanoid

end

7 comments

0

the second parameter of setPlayerCharacter can be deleted unles you do advanced nbame searching in storage

0

Can i just invite you to my game so that you can see and help me.

0

if you want, add me my user is A_Mp5

0

if you want, add me my user is A_Mp5

0

if you want, add me my user is A_Mp5

0

oops idk why i commented 3 times glitch

0

Accept my fried request. I think that's the only to allow you to edit. And also don't really expect much from the game. I made everything on my own.

This discussion is preserved as it was. New answers, comments, and votes are closed.