I made a model and I am trying to position it on the player. I don't how to fix this error I keep on getting this error that says
Unable to cast Instance to CoordinateFrame
I don't know what it is. Here is my script I don't know what I am doing wrong.
local Lighting = game.Lighting
local Vest = Lighting:WaitForChild("Flak Jacket")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("UpperTorso")
local ClonedVest = Vest:Clone()
ClonedVest.Parent = character
ClonedVest:SetPrimaryPartCFrame(character:WaitForChild("UpperTorso"))
local Weld = Instance.new("Weld")
Weld.Part0 = ClonedVest.Main
Weld.Part1 = character:WaitForChild("UpperTorso")
Weld.Parent = character:WaitForChild("UpperTorso")
ClonedVest:SetPrimaryPartCFrame(ClonedVest:GetPrimaryPartCFrame() * CFrame.new(0,0,5))
end)
end)

2 comments
The error puts in on line 12
you forgot to put a .CFrame after character:WaitForChild("UpperTorso")