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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
A_Mp5 222 Moderation Voter
3 years ago

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
0
the second parameter of setPlayerCharacter can be deleted unles you do advanced nbame searching in storage A_Mp5 222 — 3y
0
Can i just invite you to my game so that you can see and help me. II_Goodlu 8 — 3y
0
if you want, add me my user is A_Mp5 A_Mp5 222 — 3y
0
if you want, add me my user is A_Mp5 A_Mp5 222 — 3y
View all comments (3 more)
0
if you want, add me my user is A_Mp5 A_Mp5 222 — 3y
0
oops idk why i commented 3 times glitch A_Mp5 222 — 3y
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. II_Goodlu 8 — 3y
Ad

Answer this question