Hello, I am trying to make one of those Free Building games, and I want the player to change what color a new part will be. However, It only stays white (default)
Here is my local script in the tool
local sp = script.Parent
local m = game.ReplicatedStorage.make
sp.Activated:Connect(function()
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local rpos = Vector3.new(math.floor(mouse.Hit.p.x / 2 + 0.5) * 2, (math.floor(mouse.Hit.p.y / 2 + 0.5) * 2)+1, math.floor(mouse.Hit.p.z / 2 + 0.5) * 2)
m:FireServer(rpos,sp.BrickColor.Value);
end)
-- Trimmed to remove the selection thing
Server script for the RemoteEvent
local e = game.ReplicatedStorage.make
e.OnServerEvent:Connect(function(plr,pos,color)
local p = game.ReplicatedStorage.Part:Clone()
p.Position = pos
p.Parent = workspace[plr.Name.."p"] -- In player folder so nobody else can delete it
p.Color = color -- Stays 255,255,255
end)
-- Trimmed
end)
Script in the GUI
local sp = script.Parent
local plr = sp.Parent.Parent.Parent.Parent -- server script
sp.MouseButton1Down:Connect(function()
plr.Character.Build.BrickColor.Value = sp.BackgroundColor3
end)