How can I find the Player Name by here

Okay so i basically already made a script that creates a “Folder” for the player buildings i made it rename the Folder after the Player’s name, now im trying to insert the Buildings that are built by the player into his personal folder here’s a screenshot of a part in my script i tried but it won’t work

1 Like

If you want to use LocalPlayer the script should be a local script. Also you can’t use FireClient() in a local script.

Its not a local script its a 200 line actual script executed into SSS

But you can’t use LocalPlayer in a normal script.

i tried to lol then is there a way finding the player name by PlayerAdded?

local PlayerFolders = Instance.new("Folder")
PlayerFolders.Name = "PlayerFolders"
PlayerFolders.Parent = workspace
local Index = {}
game.Players.PlayerAdded:Connect(function(Player)
	local Folder = Instance.new("Folder")
	Folder.Name = Player.Name
	Folder.Parent = PlayerFolders
	Index[Player.UserId] = Folder
end)
game.Players.PlayerRemoving:Connect(function(Player)
	local Folder = Index[Player.UserId]
	if Folder ~= nil then
		Folder:Destroy()
	end
	Index[Player.UserId] = nil
end)

Sure, you can use PlayerAdded to add the folder into the player.

If this is used in a ServerScript, you’ll need to connect the player on connection towards the game by using:

game.Players.PlayerAdded:Connect(function(player)
player.Name = Name -- this is additional, in order to get the players name on PlayerAdded event


--whatever goes here

Also, is it possible for you to post your script here, so I can take a look at it?

It’s really hard to understand the snippet of code you gave us because this might be wrapped around via ~Added event.

Show us the whole script maybe so we know what we will use.

Thank you so much and is this a replacement of my old Folder Creator script cause it seems like it, and if i want to save the Buildings putted into the Player’s folder is there a way to do that cause i know i can use Tables?

Use datastore
Data Stores (roblox.com)

and GetChildren on their save folder
Instance:GetChildren (roblox.com)

1 Like

But its basically like Bloxburg i want to save Positions and Decals , Textures and the Buildings Properties

so i want to save the whole player’s plot

You will have to get the data from the folder, make it compatible with the datastore and save it

How do i create a saving system for parts using DataStores? - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like

You would have to save everything on the datastore, since you can’t save raw instances then I suggest you also take a look at this:

1 Like

btw is there a way i can get the Player’s Name? In a SSS Script cause i want to know the player name so i can transfer the buildings built by the player into the following folders we just created

When the player is placing the building you would have its ghost show on the client where it will be placed and then when the player wants to finalize the position and place the block you send the position, what type of block and any other info you need for it to the server and then the server will receive the player instance as the first argument. From there you can check on the server whether or not the player should be allowed to place the building and correctly put it inside the folder corresponding to the player by either using the Index dictionary like Index[Player.UserId] or from another script like workspace:WaitForChild("PlayerFolders"):FindFirstChild(Player.Name). orrr you can use bindable events / functions to access the Index variable from another script

No sorry, i meant like how can i check the player name cause i want to make it so when the player places a block, the block dont go to workspace as a children i want to make it so the block goes into the player personal folder as a children.

the player’s personal folder is inside workspace so you go workspace → PlayerFolders → 4HM4DJ

Use RemoteEvents, when the player places the block call the server with FireServer() with the position, block and all the info needed.

From the server you can receive with RemoteEvent.OnServerEvent:Connect(function(Player, Info)

The first argument from OnServerEvent will be always the Player.

1 Like