local Plr = game.Players.LocalPlayer
local Hrp = Plr.Character:WaitForChild(“HumanoidRootPart”)
local Play = script.Parent
local Settings = script.Parent.Parent.Settings
local SpawnFolder = workspace:WaitForChild(“SpawnLocations”):GetDescendants()
Play.MouseButton1Click:Connect(function()
Hrp.CFrame = SpawnFolder[math.random(1,#SpawnFolder)].CFrame + Vector3.new(0,3,0) --Adjust so players spawn on top of the parts.
end)
Edit: will only work if everything in the "SpawnLocations" folder is a part. You can change it from :GetDescendants() to :GetChildren() if the parts are not in any subfolders or groups.