Blocks Placement System to Grid Remastered

Hello. I made a small project and I want to share it with other people. It is an improved version of my free model made in 2021. The general concept of the open sourced project is explained in the title. Players are allowed to place blocks (snapped to grid) and destroy these blocks. Here are all features of this project:

  1. Blocks placement system;
  2. Blocks destroying system;
  3. Anti-cheat system (only for the tools in the experience);
  4. Customizable building tools (I explained it below).

Here are three tools (all of these can be duplicated to suit Your needs):
image
The tools have few customizable attributes:
image

  1. CanFloat - definies if a block can be a part of a “floating island”. This block can make other blocks with CanFloat set to false float. I showed this mechanic below in the video,
  2. Color - definies the color of placed blocks;
  3. IsColorRandom - if set to true, it randomizes colors for each placed block (and overwrites Color attribute);
  4. Material - definies material of placed blocks;
  5. MaxDistance - this attribute is common to the building tools and to the destroying tool. It definies the maximum distance of placing and destroying blocks.

The attributes can be dynamically changed by scripts in-game and the tools will adjust to the changes made in the attributes.

The video of the tools in action is here:
robloxapp-20230407-1753539.wmv (5.5 MB)
Here is a link to the project, feel free to download it:

You can also compare it to my orginal version:
https://create.roblox.com/marketplace/asset/7265807592/Blocks-Placement-System-to-Grid-Like-Minecraft
Let me know if You have any questions. Have a nice day!

14 Likes

This system looks oddly familiar to the system the game called “Blocks!” has.

3 Likes

How do you add a change color system for it?

Make sure that IsColorRandom attribute of the building tool is set to false. Next choose a color by changing Color attribute of the tool to a desired color. As I said, it is possible to change the attributes of the tool while the game is running by using a server script:

For example this means that for example the tool will place green blocks and 60 seconds later it will place yellow blocks. To change the tool while the game is running by using a script, you need to do something like this:

local tool -- Reference to the tool should be here
task.wait(10)
tool:SetAttribute("Color", Color3.fromRGB(255, 0, 0))

Let me know if I answered your question.

Everytime i try to change the attribute value, it always stays the same color

so bascially i used a color palette to send a color to a value in the player’s folder. Then i use a script inside the tool which gets the color’s value. Then it changes it’s attribute. It does change the attribute value But, it doesnt change it for the block’s color.

My script:

local player = game:GetService("Players").LocalPlayer
local blockcolor = player.Color.Color



script.Parent:SetAttribute("Color", blockcolor.Value)

Okay, I know what is the issue. The server downloads the color to use but you are changing the color by using a local script so the server can’t see the color changes. Use a remote event to change the color attribute on server side.

Can you demonstrate a script.
do i use localscript?

Sure, I will do it later when I do some stuff on my PC.

To demonstrate it I made a system where player can change color to green by pressing Q and player can change color to blue by pressing E. Read the steps to figure this out.

  1. To the tool insert RemoteEvent called “ChangeColor”, a server script called “AcceptColors” and a local script called “RequestColors”. The result of this step should look like this (I marked in red instances made in this step):
    image
  2. Modify the source code of the RequestColors local script so it looks like this:
local green, blue = Color3.fromRGB(0, 255, 0), Color3.fromRGB(0, 0, 255)
local changeColor = script.Parent:WaitForChild("ChangeColor")
local begin = Enum.UserInputState.Begin

game:GetService("ContextActionService"):BindAction("To green", function(actionName, inputState, inputObject)
	if inputState == begin then
		changeColor:FireServer(green)
	end
end, false, Enum.KeyCode.Q)
game:GetService("ContextActionService"):BindAction("To blue", function(actionName, inputState, inputObject)
	if inputState == begin then
		changeColor:FireServer(blue)
	end
end, false, Enum.KeyCode.E)
  1. Repeat the step 2 but with different code and for AcceptColors server script:
local tool = script.Parent

tool.ChangeColor.OnServerEvent:Connect(function(player, requestedColor)
	tool:SetAttribute("Color", requestedColor)
end)

Let me know if something is confusing to you.

where did the requestedcolors come from

I created a new local script, I named it “RequestColors” and modified the script in the code editor.

This answer seems to simple to me, could you specify what is the issue? I’m not sure if I answered your question.

EDIT: You can specify the step, which is not clear to you.

nvm i figured it out, thank you so much

1 Like

Last Question. Is there a way to make it client sided for colors?

Yes but it will appear only for the client who set the colors. By saying by that I mean that for the client the blocks will appear let’s say green but for others the colors of these blocks will be still white (previous color).
EDIT: If it was possible to change on client for others it would mean that the game would be very vunerable to exploits.

Hello, can you try and demonstrate a script that only changes the colors of the client instead of the server, like if Player one has red selected, and player 2 has blue. P1 placed a block, its red. P2 placed a block, its blue.

if possible i can share you an uncopylocked version of the game im working on and can you see how it can be client sided while also having a server sided block placement

Do you want to make it so blocks placed by player one are red (for everyone) and blocks placed by player two are blue (for everyone)?

It does not seem like a problem. You can consider sending your code where the change mentioned above should be implemented but its up to you how we will do it.

The thing that is wrong is that if a one player picks a color, it is the server’s color. i want to make it so that if a player picks a color, thats their color.

As i said, it would be a problem if the whole server shared only one color palette.