So you want to make a system, where colors of blocks are exclusive to a specific client. Here is a general idea how to do that:
Edit the server script of the tool so it inserts an object value to the block. The instance should hold a value of a player who placed the block.
Make a client sided script in starter player scripts detecting placed blocks. The script checks if the object value’s value is equal to local player. If that’s true - change the color of the added child (block) to a desired color.
I hope that I understood you correctly. If I am wrong or you still need help, let me know.
What I said can be used to make something like that:
Player1 sees his block as blue blocks and sees Player2’s blocks as red blocks.
Player2 sees his blocks as blue blocks and sees Player1’s blocks as red blocks.
Edit: I was not precise enough in my previous reply, I did not specify how to color enemy’s blocks but you might have an idea how to do that after I partially answered the question.
nvm, My problem is that if a player selects a color, that color will be everyone’s. And i want them to have their own color pallete while also seeing other’s color
I assume that you will leave it uncopylocked as long as this problem remains unsolved (so I do not have to download it now). I will do my best to fix it tomorrow.
I came up with a solution to the problem. Follow these steps:
In ReplicatedStorage there are two instances named ChangeColor and ChangeMaterial. Move these objects to StarterPack
Open the server script called Script in Place blocks tool and replace the code with this:
local ChangeColor = script:FindFirstAncestorOfClass("Player").Backpack:WaitForChild("ChangeColor")
local tool = script.Parent
local ChangeMaterial = script:FindFirstAncestorOfClass("Player").Backpack:WaitForChild("ChangeMaterial")
ChangeColor.OnServerEvent:Connect(function(player, requestedColor)
tool:SetAttribute("Color", requestedColor)
end)
ChangeMaterial.OnServerEvent:Connect(function(player, requestedMaterials)
tool:SetAttribute("Material", requestedMaterials)
end)
Go to PaletteScript client script and replace your code with this:
-- Made by denkodin (https://www.roblox.com/users/342156146/profile)
-- YouTube channel: https://www.youtube.com/c/H2MinRobloxStudio
local frame = script.Parent
local template = frame.Template:Clone()
local player = game:GetService("Players").LocalPlayer
local color = player.Color.Color
local ChangeColor = game:GetService("Players").LocalPlayer:WaitForChild("Backpack"):WaitForChild("ChangeColor")
frame.Template:Remove()
function OnColorButtonClick(h, s, v)
color.Value = Color3.fromHSV(h, s, v)
end
for x = 0, 12 do
for y = 0, 8 do
local color_button = template:Clone()
color_button.Name = "ColorButton[" .. x .. "," .. y .. "]"
color_button.Parent = frame
color_button.Position = UDim2.new(x * color_button.Size.X.Scale + x * 0.004, 0, y * color_button.Size.Y.Scale
+ y * 0.004, 0)
local h, s, v = 0, 0, 0
if x < 12 then
h = x * 30 / 360
s = y < 4 and 1 or (1 - (y - 4) * 20 / 100)
v = y > 4 and 1 or ((y + 1) * 20 / 100)
else
h, s = 0, 0
v = y * 12.5 / 100
end
color_button.Color.BackgroundColor3 = Color3.fromHSV(h, s, v)
color_button.MouseButton1Down:Connect(function()
OnColorButtonClick(h, s, v)
ChangeColor:FireServer(color.Value)
end)
end
end
Use the opened tool to replace this in every script: game:GetService("ReplicatedStorage"):WaitForChild("ChangeMaterial")
With this: game:GetService("Players").LocalPlayer:WaitForChild("Backpack"):WaitForChild("ChangeMaterial")
That is all. After following these steps it should work as intended. The problem is the fact that every client was firing the same remote events making it so every server script with this event received the signal. To fix it I made it so every client has his own exclusive remove events. I do not know how to put it in nice words but I hope that you understand what I mean and it will help you in the future. Have a nice day.
Just be happy. That is enough. I am glad that I can bring joy to this platform. If you want to donate Robux, you can do this in one of my games: Super Tic Tac Toe - Roblox