ObjectValue doesn't have CFrame value

Later, I rescripted a train spawner called “SpawnTrainScript2”, but the ObjectValue doesn’t have the CFrame property.

Look at some script:

local plrEngine = {}
local spawnLocation = workspace.spawnLocation
local replicatedStorage = game.ReplicatedStorage
local spawnTrainEvent = replicatedStorage.SpawnTrainEvent

spawnTrainEvent.OnServerEvent:Connect(function(plr, engineAsset, sLocation)
	
	if engineAsset then
		
		
		if plrEngine[plr] then
			
			
			plrEngine[plr]:Destroy()
		end
		
		local randomBerth = sLocation
		
		
		local newEngine = engineAsset:Clone()
		
		
		newEngine:PivotTo(randomBerth.CFrame + Vector3.new(0, 10, 0))
		local char = plr.Character or plr.CharacterAdded:Wait()
		local _, engineSize = newEngine:GetBoundingBox()
		char:PivotTo(newEngine:GetPivot()*CFrame.new(engineSize.X / 2 + 5, 0, 0))
		
		
		newEngine.Parent = workspace
		
		plrEngine[plr] = newEngine
	end
end)

LocalScript:

local p = script.Parent

local player = game.Players.LocalPlayer
local trainSpawnerGui = player.PlayerGui.TrainSpawnerGui

local replicatedStorage = game:GetService("ReplicatedStorage")

local thomas = replicatedStorage.TrainAssets.Locomotives.Steam:WaitForChild("Thomas")
local sLocationSelected = trainSpawnerGui.TrainSpawnerFrame:WaitForChild("SpawnLocationSelected").Value

local test1 = game.Workspace.spawnLocation:WaitForChild("Test1")

local locoListFrame = p.Parent.SteamLocoListFrame

local engineInfo = require(p.Parent.ModuleScript)

engineInfo.MakeEngineInfo(thomas, "Thomas", locoListFrame, sLocationSelected)

How do I fix the CFrame property instead of ObjectValue?

Check the value inside the ObjectValue.

If it is not a part then it will not have a CFrame.

This is exactly, but look:
Capture d’écran 2023-11-22 142246

CFrame property is not a part of the ObjectValue, but it attempts to index with CFrame.

You need to click on Value and then click on something in your game.

Think of it as a short-cut to the object (so you don’t have to type a long path in the code.

Value needs to be assigned in the ObjectValue