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?

Asked by 4 years ago
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFrame + Vector3.new(0,10,0)
table.remove(AvailableSpawnPoints,1)

character is defined as player.Character

When it tries to teleport, it gives the error CFrame is not a valid member of model

I edited this script a bit, so it is not mine and I am new to programming. Can anyone please help?

1 answer

Log in to vote
0
Answered by
OBenjOne 190
4 years ago
Edited 4 years ago

I would assume that "AvalableSpawnPoints[1]" is a model. To fix this, try replacing line 2 with:

AvailableSpawnPoints[1].Part.CFrame + Vector3.new(0,10,0)

Note: "Part" should be replaced with the name of one of the parts actually in the model saved in "AvalableSpawnPoints".

Models do not have a CFrame, while parts do, so you have to get the CFrame of a part in the model rather than the model.

Edit:

 AvailableSpawnPoints = {workspace.Part}
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFrame    + Vector3.new(0,10,0)
table.remove(AvailableSpawnPoints,1)

This script works fine for me, is their any difference in your table?

0
Thanks for your answer, but AvalableSpawnPoints is a list, and 1 is the first item on it. This script is part of a loop that goes through all the spawnpoints to make sure that players don't spawn in the same place. DaHugoDeus 5 — 4y
0
Is the first item on your list a model or a part or something else? OBenjOne 190 — 4y
0
A part DaHugoDeus 5 — 4y
0
and the error is on line 1? OBenjOne 190 — 4y
0
Yes DaHugoDeus 5 — 4y
Ad

Answer this question