How can I find the Player Name by here

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

yes but if i want to type that into a local script i would say
local playerName = game.Players.LocalPlayer.Name
newBlock.Parent = game.Workspace.PlayerFolders:FindFirstChild(playerName)`
even thought my script is a SSS Script so how would i do that in a SSS Script

From the client you use a remote event or function and fire it so the server gets the data of where the block needs to be placed + the player’s instance as the first argument

1 Like

Thanks thats a good way to do it also but im trying to see if i can find a simpler way lol

i already have the building system and all that i just need to change the parent of the placed building from workspace to the player personal folder

Sorry to say but that’s probably one of the easiest ways I can think, you will need to communicate with the server or else all the objects will only be on the client, which means they will be not existant on the server.

For the communication with the server you can use the RemoteEvents.

1 Like

send your building system scripts

First Script

local snap = 3


game.ReplicatedStorage.PlacingSystem:WaitForChild("PlaceBlockRE").OnServerEvent:Connect(function(plr, blockType, target, targetSurface, removeOrPlace)
	
	
	if removeOrPlace == "placing" then
	
		local position
		
		if targetSurface == Enum.NormalId.Top then
			position = target.Position + Vector3.new(0, snap, 0)
				
		elseif targetSurface == Enum.NormalId.Bottom then
			position = target.Position - Vector3.new(0, snap, 0)
				
		elseif targetSurface == Enum.NormalId.Left then
			position = target.Position - Vector3.new(snap, 0, 0)
				
		elseif targetSurface == Enum.NormalId.Right then
			position = target.Position + Vector3.new(snap, 0, 0)
				
		elseif targetSurface == Enum.NormalId.Front then
			position = target.Position - Vector3.new(0, 0, snap)
				
		elseif targetSurface == Enum.NormalId.Back then
			position = target.Position + Vector3.new(0, 0, snap)
		end
		
			
		local blockInPos
			
		for i, d in pairs(workspace:GetDescendants()) do
				
			if d:IsA("BasePart") and d.Position == position then blockInPos = true end
		end
			
			
		if not blockInPos and position then
				
			local newBlock = blockType:Clone()
			newBlock.Size = Vector3.new(snap, snap, snap)
			newBlock.Anchored = true
			newBlock.Position = position
			
			local playerName = game.Players.PlayerAdded:Connect()
			newBlock.Parent = game.Workspace:FindFirstChild(playerName.Name)
			game.ReplicatedStorage.PlacingSystem.PlayPlacingSoundRE:FireClient(plr)
		end
		
-- Checks if the block is a Terrain		
	elseif removeOrPlace == "removing" then
		if target and target:FindFirstChild("Terrain") then
			workspace.Terrain:FillBlock(target.CFrame, target.Size, Enum.Material.Air)
			game.ReplicatedStorage.PlacingSystem.PlayRemovingSoundRE:FireClient(plr)
			target:Destroy()
			
-- Checks if the block is a Solid
		elseif target and target:FindFirstChild("Placeable") then
			target:Destroy()			
			game.ReplicatedStorage.PlacingSystem.PlayRemovingSoundRE:FireClient(plr)	
		end
	end
end)




local gridX, gridZ = 100, 100


for x = 1, gridX do
	
	for z = 1, gridZ do
		
		
		local block = game.ReplicatedStorage.AdminBlock:Clone()
		block.Size = Vector3.new(snap, snap, snap)
		block.Anchored = true
		
		block.Position = Vector3.new(snap * x, snap, snap * z)
		
		block.Parent = workspace
	end
end

Second Local Script

local snap = 3

--Blocks
local blocks = game.ReplicatedStorage:WaitForChild("Blocks")

local placeRE = game.ReplicatedStorage.PlacingSystem:WaitForChild("PlaceBlockRE")


local chosenBlock = blocks:GetChildren()[1]


for i, block in pairs(blocks:GetChildren()) do
	
	local clonedTemplate = script:WaitForChild("BlockButton"):Clone()
	
	local name = block.Name
	clonedTemplate.BlockName.Text = name
	
	
	local blockClone = block:Clone()
	blockClone.Size = Vector3.new(snap, snap, snap)
	blockClone.Parent = clonedTemplate.BlockImage
	
	
	local cam = Instance.new("Camera")
	clonedTemplate.BlockImage.CurrentCamera = cam
	cam.Parent = clonedTemplate.BlockImage

	cam.CFrame = CFrame.new(blockClone.Position + Vector3.new(3.3, 3.3, 3.3), blockClone.Position)
	
	
	clonedTemplate.Parent = script.Parent
	
	
	clonedTemplate.MouseButton1Click:Connect(function()
		chosenBlock = blocks[name]
	end)
end
--Terrains
local terrains = game.ReplicatedStorage:WaitForChild("Terrains")

local placeRE = game.ReplicatedStorage.PlacingSystem:WaitForChild("PlaceBlockRE")


local chosenTerrain = terrains:GetChildren()[1]


for i, terrain in pairs(terrains:GetChildren()) do

	local clonedTemplate = script:WaitForChild("BlockButton"):Clone()

	local name = terrain.Name
	clonedTemplate.BlockName.Text = name


	local terrainClone = terrain:Clone()
	terrainClone.Size = Vector3.new(snap, snap, snap)
	terrainClone.Parent = clonedTemplate.BlockImage


	local cam = Instance.new("Camera")
	clonedTemplate.BlockImage.CurrentCamera = cam
	cam.Parent = clonedTemplate.BlockImage

	cam.CFrame = CFrame.new(terrainClone.Position + Vector3.new(3.3, 3.3, 3.3), terrainClone.Position)


	clonedTemplate.Parent = script.Parent.Parent.TerrainList


	clonedTemplate.MouseButton1Click:Connect(function()
		chosenBlock = terrains[name]
	end)
end



local mouse = game.Players.LocalPlayer:GetMouse()

local selectingBox = Instance.new("SelectionBox", workspace)

game:GetService("RunService").RenderStepped:Connect(function()
	
	local target = mouse.Target
	if target then
		
		if target:FindFirstChild("Placeable") then
			
			selectingBox.Adornee = target
			
		else
			selectingBox.Adornee = nil
		end
	end
end)


local isRemoving = false

mouse.KeyDown:Connect(function(key)
	if key == "x" then
		isRemoving = true
	end
end)
mouse.KeyUp:Connect(function(key)
	if key == "x" then
		isRemoving = false
	end
end)


local isPlacing = false

mouse.Button1Down:Connect(function()
	isPlacing = true
end)
mouse.Button1Up:Connect(function()
	isPlacing = false
end)


game.ReplicatedStorage.PlacingSystem.PlayRemovingSoundRE.OnClientEvent:Connect(function()
	script.RemovingSound:Play()
end)


game.ReplicatedStorage.PlacingSystem.PlayPlacingSoundRE.OnClientEvent:Connect(function()
	script.PlacingSound:Play()
end)

local blockCooldown = 0.25

while wait() do
	
	local target = mouse.Target
	if target and target:FindFirstChild("Placeable") then
	
		if isPlacing then
						
			placeRE:FireServer(chosenBlock, target, mouse.TargetSurface, "placing")
			wait(blockCooldown)		
			
		elseif isRemoving then
				
			placeRE:FireServer(nil, target, nil, "removing")
			wait(blockCooldown)
		end	
	end
end

plr is right here…

so…


1 Like