Hi, so I sometimes I get the following message when trying to copy a player avatar to a podium (part).
‘attempt to index nil with CFrame’
This is the block of code that is running at the time and specifically the error is around the line that reads.
‘clonedChar.PrimaryPart.CFrame = PodiumCFrame’
Now I’ve searched for this error message and the best info I could find relates to a primary part not being assigned, but that didn’t work so i’m wondering if there is an obvious syntax error here?
Is anyone able to cast an eye over the code block to see if it looks fine?
(thanks in advance)
local function GrowSize(character, Podium, PodiumCFrame)
local humanoid = character.Humanoid
character.Archivable = true
local clonedChar = character:Clone()
clonedChar.Name = character.Name
clonedChar.Parent = Podium.PodiumPlayer
local FF = Instance.new("ForceField",clonedChar)
FF.Visible = false
task.spawn(function()
while wait(2) do
if clonedChar == nil then return end
clonedChar.PrimaryPart.CFrame = PodiumCFrame -- ERROR LINE
end
end)
clonedChar.Humanoid.HeadScale.Value = MULTIPLIER_GROWTH
clonedChar.Humanoid.BodyDepthScale.Value = MULTIPLIER_GROWTH
clonedChar.Humanoid.BodyWidthScale.Value = MULTIPLIER_GROWTH
clonedChar.Humanoid.BodyHeightScale.Value = MULTIPLIER_GROWTH
clonedChar.PrimaryPart.CFrame = PodiumCFrame
CreateAnimation("rbxassetid://507770239", "Wave", clonedChar.Humanoid)
clonedChar.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end