Hi.
I have a BoolValue that gets set to true when my game starts.
A global script in StarterCharacterScripts (ergo, in all the players) detect when this happens, finds the map that was automatically generated by another script and teleports the player to a part included named PlaceToStart. And before you ask, all of the maps that could be generated contains this part, at least that's what I found, and the part was anchored.
This is the code:
game.Workspace["Special Stuffs"].GameProgress.Changed:Connect(function() -- if the Game Progress has been updated
if game.Workspace["Special Stuffs"].GameProgress.Value == true then -- if it is updated to say the game has started
script.Parent.CFrame = game.Workspace.Map:FindFirstChildOfClass("Model").PlaceToStart.CFrame -- teleport to this part
end
end)
but whenever I run it, I get one of these as an error (never all):
21:37:28.814 - Workspace.KicksForTricks56.GameTeleporter:3: attempt to index a nil value
21:42:38.957 - PlaceToStart is not a valid member of Model
21:45:48.891 - CFrame is not a valid member of Model
I tried using :FindFirstChild() and :WaitForChild(). It didn't give me an Infinite yield warning when I did it so I know it acknowledges that it exists, but it still doesn't think it's a vaild member of the map! I am baffled about why this is happening, especially when I check in Explorer and find it that the part still does exist, both in-game (after I get the error) and in editor mode. Does anybody know what is happening?

9 comments
Is the part somehow local?
I don't know what that means, but I think this may help: I don't spawn it via a local script but the maps are stored in server storage before being used, an Instance that may be local
don't worry your part isn't local if the script that created it is in the workspace
Wait... I don't even know if models have CFrames... hey, I don't think they do! Try setting a primary part for the model then instead of script.Parent.CFrame (on line 3) try script.Parent.PrimaryPart.CFrame
Model probably don't have CFrames meaning that your part doesn't have anything to do with your error. The error is your explanation: CFrame is not a valid member of model.
Thanks, that helped! :)
You can set the cframe of a model with their primarypart. You can either assign the primarypart of the model manually or by a script. Let me make a example.
Also it's a bad idea to put it in starterplayerscripts making so many can make unexpected behaviour with a single script in serverscriptservice doing the stuff and then teleporting all the players with a remote using :FireAllClients will do
Although since I don't have enough information I'm not sure what to do, because some of your errors is because of either your hierarchy or that they dont exist. The most i can help is what i've said about the model cframes. :SetPrimaryPartCFrame would be the method to do so. https://wiki.roblox.com/index.php?title=API:Class/Model/SetPrimaryPartCFrame