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

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

Asked by
Anubizx 76
6 years ago

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

Log in to vote
0
Answered by
phxtn 154
6 years ago
Edited 6 years ago

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

0
accessing the character through game.Workspace is not reliable (could be a part and player w same name) lucided 15 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

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.

Answer this question