Hi there,
I’m not sure why it won’t work, what is the alternative to make this piece of code work?
function createPart(color)
local Part = Instance.new("Part")
Part.Size = Vector3.new(1,1,1)
Part.Anchored = true
Part.CanCollide = false
Part.Material = Enum.Material.SmoothPlastic
Part.Parent = game.Workspace
Part.BrickColor = color -- why won't it accept color
return Part
end
In script*
local tweenService = game:GetService("TweenService")
local tweenInformation = TweenInfo.new(
5,
Enum.EasingStyle.Quint,
Enum.EasingDirection.InOut,
0,
false,
0
)
function createPart(color)
local Part = Instance.new("Part")
Part.Size = Vector3.new(1,1,1)
Part.Anchored = true
Part.CanCollide = false
Part.Material = Enum.Material.SmoothPlastic
Part.Parent = game.Workspace
Part.BrickColor = color
return Part
end
local partInfo1 ={
Size = Vector3.new(2.5,0.3,2.5);
}
local partInfo2 = {
Size = Vector3.new(2.7,0.2,2.7);
}
local function makeNewPartAndAnimate()
local newPart1= createPart(BrickColor.Black)
local newPart2= createPart(BrickColor.DarkGray)
local tween1 = tweenService:Create(newPart1, tweenInformation, partInfo1)
local tween2 = tweenService:Create(newPart1, tweenInformation, partInfo2)
wait(10)
tween1:Play()
tween2:Play()
end
makeNewPartAndAnimate()