I want to change the Part name into Players.LocalPlayer

I’d like to change the part name to the player’s name

Here’s an example of what I’m aiming for, but it doesn’t just include my players’ names.
(I did this manually)

I tried doing game.Players.LocalPlayer or game.Character but none of them work.

1 Like

So is it in normal Script or Local script?

If it’s a normal Script so you want it to be replicated across both client and server you need to do something like this:

local Part = Instance.new("Part") 
Part.Name = player.Name
Part.Parent = workspace
1 Like
local Players = game:GetService('Players')

local Part = nil

  if stuff.Parent:FindFirstChild('Humanoid') then
    local b = stuff.Parent
    local player = Players:GetPlayerFromCharacter(b)
    print(('%s farted on the part'):format(player.Name))
    local part = Instance.new('Part')
    part.Name = player.Name

1 Like

It was in normal Script and not a Local Script.

Edited my post go check it out.

You need to reference Player variable somehow in my script I showed you Making new part and name it with name of player that joined the game.

Oh I see @p49p0 already gave solution.

1 Like

It gave me an error

i mean change the Part to the part location
nil = nothing :man_facepalming:

1 Like

I tried yours, but It doesn’t send a part from the folder.

Sorry it is just an example not fully working script.

1 Like

LocalPlayer is only available on the client.

Oh I see, I was confused in there, thanks for the correction.

To get the “player”, you could do something like for example:


projectile.Name = player.Name


I don’t know your full code, it would help if perhaps you could post it.

(Replied to wrong person, I’m replying to @kachupiyt )

1 Like