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

Help! What's the code to use in a Player?

Hi, i am developing a Hair Color Menu, so... you can choose your hair color and it will be changed but i don't know what script can i use for Detect Player Model.

if P.Data.HairC.Value == 0 then hair = game.Workspace.Anubizx.Hair.Handle hair.BrickColor = BrickColor.new("Deep orange") elseif P.Data.HairC.Value == 1 then hair = game.Workspace.Anubizx.Hair.Handle hair.BrickColor = BrickColor.new("Deep orange") end

I need to change game.Workspace.Anubizx for the player that is using the script.

Sorry if you dont understand xD

2 answers

How:

local plr = game.players.LocalPlayer

^ This is how to access a player in game.Players

game.Workspace[plr.Name].Bla.Bla.Bla

^ This is how to access a player through a script in Workspace. You must have the first peiece of code above in your script as well.

Hope this helped xD

-PhotonLightning

1 comment

0

accessing the character through game.Workspace is not reliable (could be a part and player w same name)

Start with:

local plr = game.Players.LocalPlayer

How to access a player through game.Players (You need the above code):

plr.Character.Bla.Bla.Bla

This is an easy and reliable way of getting the character. It doesn't require Workspace or anything, just the game.Players service.

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