Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

CFrame is not a valid member of Model? [Solved]

Asked by
LaysCo 61
4 years ago
Edited 4 years ago

When i try to clone a model and then weld it to the player i get the error CFrame is not a valid member of Model

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Char)
        local Part = Char:WaitForChild("Head")
        local helm = game.ReplicatedStorage.Helm
        local Weld = Instance.new("WeldConstraint", Char)
        local clone = helm:Clone()
        clone.Parent = game.Workspace.PlayerGear
        clone:SetPrimaryPartCFrame(Part.CFrame) 
        Weld.Part0 = Part
        Weld.Part1 = clone.Center
    end)
end)

3 answers

Log in to vote
1
Answered by
Wiscript 622 Moderation Voter
4 years ago

You are trying to index the model on line 12 with the variable "clone". This won't work as "clone" is a model and models do not have a CFrame property. A hitbox basepart would be the way to go, then indexing it accordingly.

Ad
Log in to vote
1
Answered by
3F1VE 257 Moderation Voter
4 years ago

CFrame isint a property of "Model" Try setting a PrimaryPart and moving that.

0
how would i the primary part LaysCo 61 — 4y
0
"how would i the primary part" lol botw_legend 502 — 4y
Log in to vote
0
Answered by 4 years ago

so cframe isn't a property of a model like dimondflash57 said and set the primarypart to a part in the model what this does is when you set the cframe (i will tell you how in a sec) then that part will go to that cframe and all the other parts in the model will follow like if before it was to the right of the primary part then after it will still be to the right ok now how to do it in the script so its pretty easy all you have to do is:

model:SetPrimaryPartCFrame()--CFrame goes here

hope this helped! tell me if i forgot anything

Answer this question