New here, hoping you get help me out. Before I paste the code I would like to give you a run down of what I am trying to do.
I have a Model in ServerStorage that is to get copied and placed into Workspace, after it is moved to Workspace, the code will check for certain conditions and then move the player(s) to a certain brick named "SpawnPoint" that is inside that newly moved Model. However, I keep getting the error attempt to index a nil value
models = game.ServerStorage.blah:GetChildren() function movemodel() t = models[math.random(1, #models)]:clone() t.Parent = game.Workspace end while true do wait() wait() movemodel() wait(5) for i, v in pairs(game.Players:GetPlayers()) do if v.TeamColor == BrickColor.new("Bright yellow") then v.Character.Torso.CFrame = game.Workspace:FindFirstChild("SpawnPoint").CFrame + Vector3.new(0,3,0) end end
I don't know exactly how your Objects are arranged in your Explorer, but shouldn't "SpawnPoint" be in a model located in game.Workspace
instead of being directly in game.Workspace
?
Not sure whats with the downvotes, I am asking a genuine question, if you paste in that code and put a Model in a model in ServerStorage it will not work for some strange reason.