Local _spawn = Instance.new("ObjectValue") Player.CharacterAdded:Connect(onCharacterAdded) Local function onCharacterAdded(character)Ĭharacter:PivotTo(:GetPivot()) Local spawnFolder = workspace.Folder -Path to folder of spawn parts. Local players = game:GetService("Players") If you wanted the player to respawn at there spawnpoint when they die as well, you can simply hook up the Humanoid.Died and make it CharacterAdded as well, although you didn’t say you wanted to so I didn’t account for it in this script. Local plrWhoTouched = game.Players:FindFirstChild() If hit.Parent:FindFirstChildWhichIsA("Humanoid") then If workspace.SpawnFolder:FindFirstChild(result) thenĬ = workspace.SpawnFolder:FindFirstChild(result).CFrameįor _, v in pairs(SpawnFolder:GetChildren()) do Local SpawnValue = Instance.new("StringValue") Local char = plr.Character or plr.CharacterAdded:Wait() Local SpawnFolder = workspace.SpawnFolder Local SpawnData = DS:GetDataStore("Spawndata") If your testing this in Studio make sure to go into Game Settings > Security and turn on “Enable Studio Access to API Services” local DS = game:GetService("DataStoreService") As for the code, here is something that would probably work although I haven’t tested it. Here is an example of how I set up the spawns.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |