Cframe support (train)

Hello, its horse again
We have made a spawn for trains but they appear to spawn half submerged in the ground when we set them to spawn via cframe mid-air and fall to the ground ready for use.
We then tried moving the train to spawn in a different location and it spawned in the same place as before, half submerged on the wrong track.
Please help!
Horse

Script below.

script.Parent.MouseButton1Click:Connect(function()

    local class153 = game.ServerStorage.Trains.test153:Clone()
    class153:SetPrimaryPartCFrame(CFrame.new(642.594, 30.651, 645.131))
    class153.Parent = workspace

    class153.Anchored = false

end)

I don’t really understand for what purposes you’re setting new primary part CFrame?

To move the train to the correct place.

what is the signifigance of CFrame.new(642.594, 30.651, 645.131)

It moves the train to the correct position in coordinates but when it is tested it dosent move it correctly.

If you’ve set the model primary part, it should work. Because as I see from script you move PrimaryPartCFrame to the new position. Also try adding wait() before Unanchoring the model

1 Like

thank you! I will try it out now!

i did this:
local class153 = game.ServerStorage.Trains.test153:Clone()

script.Parent.MouseButton1Click:Connect(function()
	
	class153:SetPrimaryPartCFrame(CFrame.new(626.646, 28.77, 639.544))
	class153.Parent = workspace
	wait()
	class153.Anchored = false
	
end)

and I got this result:

I tried to change places to

  local class153 = game.ServerStorage.Trains.test153:Clone()

script.Parent.MouseButton1Click:Connect(function()
    	
    	class153:SetPrimaryPartCFrame(CFrame.new(642.516, 34.037, 645.331))
    	class153.Parent = workspace
    	wait()
    	class153.Anchored = false
    	
    end)

yet, it did the same thing

you need to put number inside brackets like wait(1)

I did that (or @robloxer10_8 did that), wait(5), but it did the same thing