I want to make a character selection menu in my game but I’ve had a few problems.
The problems are that the character is not changing.
I have tried to set the player,character to the rig but the character scripts in my character don’t transfer over. I have also tried to replace the starterplayer rig through a script, and then resetting the character but that doesn’t seem to change the character.
I want the character to change rigs, but I don’t want to loose the GUI data, and the StarterCharacterScripts.
What I have currently is that when a gui button is pressed, it fires an event deleting the old startercharacter and replacing it with a different rig in the replicated storage, but it doesn’t seem to work. Here is my script:
LocalScript in GUI:
Desc.Buttons.Select.MouseButton1Click:Connect(function()
if CharacterVal == "CharacterOne" then
game.StarterPlayer:FindFirstChild("StarterCharacter"):Destroy()
local StarterCharacter = game.ReplicatedStorage.Characters.CharacterOne:Clone()
StarterCharacter.Parent = game.StarterPlayer
StarterCharacter.Name = "StarterCharacter"
game.ReplicatedStorage.Characters.Reset:FireServer(1,1)
elseif CharacterVal == "CharacterTwo" then
--Run for character 2 and so on (You get the Idea)
end
end)
ServerScript in ServerScriptService:
game.ReplicatedStorage.Characters.Reset.OnServerEvent:Connect(function(plr, character)
game.ReplicatedStorage.Characters.Reset:FireAllClients(plr, character) -- Just so other local scripts can access this information
wait(1)
plr:LoadCharacter()
end)
Thank you for your time!
(BTW I’m new to DevForum, sorry if it doesn’t make sense.)