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

Male or Female Starter Characters aren't working?

Asked by 2 years ago

I have a prompt that asks if the user would like to be male or female in the game. When you click the male button, the male starter character is used, and when you click the female button, the female starter character is used, but for some reason neither starter characters are being implemented. Does anyone know why?

Male Button Local Script:

local btn = script.Parent
local camera = game.Workspace.CurrentCamera
local MaleCharacter = game.Workspace.StarterCharacter1
local StarterPlayer = game:GetService("StarterPlayer")

btn.MouseButton1Click:Connect(function()
    btn.Parent.Visible = false
    btn.Parent.Parent.PlayButton.Visible = true
    btn.Parent.Parent.CreditsButton.Visible = true
    btn.Parent.Parent.ChangelogButton.Visible = true
    MaleCharacter.Parent = StarterPlayer
    MaleCharacter.Name = "StarterCharacter"
end)

Female Button Local Script:

local btn = script.Parent
local camera = game.Workspace.CurrentCamera
local FemaleCharacter = game.Workspace.StarterCharacter2
local StarterPlayer = game:GetService("StarterPlayer")

btn.MouseButton1Click:Connect(function()
    btn.Parent.Visible = false
    btn.Parent.Parent.PlayButton.Visible = true
    btn.Parent.Parent.CreditsButton.Visible = true
    btn.Parent.Parent.ChangelogButton.Visible = true
    FemaleCharacter.Parent = StarterPlayer
    FemaleCharacter.Name = "StarterCharacter"
end)

1 answer

Log in to vote
1
Answered by
imacodr 40
2 years ago

The reason this is happening is because when you are trying to set the new StarterCharacter the current player character is already loaded. This means you will have to replace the current loaded StarterCharacter.

Ad

Answer this question