Hi! I have been staring at this code for like 30 minutes or so but I just cannot see what the problem is. I am trying to change the color of a part through a script. The variable color does work and I have checked that many times already.
Here is the code:
if color ~= nil then
set.Color = Color3.fromRGB(color)
else
set.Color = Color3.fromRGB(99, 95, 98)
end
local function placeBlock()
local item = workspace.GhostBlock
local part = item:Clone()
part:SetPrimaryPartCFrame(CFrame.new(posx, posy, posz))
part.Name = 'block'
part.Parent = workspace
local set = part.PrimaryPart
set.Name = "Part"
if color ~= nil then
set.Color = Color3.fromRGB(color)
else
set.Color = Color3.fromRGB(99, 95, 98)
end
set.Transparency = 0
set.Material = "SmoothPlastic"