Snippet of my code, where SelectedPart is an ObjectValue with the value of a model stored in ReplicatedStorage.
local model = script.SelectedPart local cloneModel = model:clone() cloneModel.Parent = game.Workspace local modelCFrame = cloneModel:GetModelCFrame() mouse.TargetFilter = cloneModel
The error when I run is 'GetModelCFrame is not a valid member of ObjectValue'
How do I fix this?
Seems like 'model' is an ObjectValue
. This is okay, but ObjectValues don't support the GetModelCFrame function. You have to index it's Value
property in order to reference the Model it holds(assuming the Value IS actually a model).
local model = script.SelectedPart local cloneModel = model.Value:clone() --Index the Value cloneModel.Parent = game.Workspace local modelCFrame = cloneModel:GetModelCFrame() mouse.TargetFilter = cloneModel