Why is this player gender starter character script not working

This thing isn’t working.

Game.Players.LocalPlayer = game:GetService(“PlayerService”)

Player.Genders = (“Male”,”Female”)

if Player.Gender = Male do
Player.Parent = game.StarterPlayer.MaleAvatar

if Player.Gender = Female do
Player.Parent = game.StarterPlayer.FemaleAvatar

  end)
end

This is not how scripting works.

A lot of this is just something you guessed by the looks of it.

I suggest you learn how Lua works first. Look at the “Learn Roblox | Coding and Scripts” section on DevHub as well as threads on DevForum about learning scripting.

A couple obvious things:

should be

local Player = game:GetService("Players").LocalPlayer

you used fancy quotes which don’t work.

this is essentially useless

Player.Gender is not a thing, and to compare (which you’re doing) you’d need to use == not = and Male is undefined. It should be then or then do (frankly I don’t know who’d use that) not just do - that would be right for a loop, not an if statement.

And Player.Gender likely never will exist since Roblox literally can’t give out that information.

3 Likes

Also be aware that the #help-and-feedback:code-review category is about improving already working code.

#help-and-feedback:scripting-support is a category to help you with issues.

Note that neither of these places should be used to ask for someone else to write code for you. Based on the original code you’ve given, unfortunately the only lines that are remotely correct is end and even one of those is in the wrong place and has a random parenthesis.

Take in some of the advice and tips from iiRealistic_Dev, but ultimately you need to learn the basics to be able to make use and value from the forum. Try YouTube tutorial series, the basics on the Developer Hub, or take a look at some existing scripts in Free Models in Studio.

3 Likes

@iiRealistic_Dev, not real info. The gender you signed up for. Like you started with the default avatars, like the male and female default avatars. The setting with the players gender that they signed up for would choose the male and female avatar models.

Nonetheless, it’s done pretty much completely wrong, as a lot of what you tried doing can’t be done or is done incorrectly; try learning some Lua then retry this.

Just a note that I have recategorised this thread as it was previously miscategorised. Please see BanTech’s post and remember to read category guidelines before posting threads here.