hello! i’m trying to work on a map loading script and now i want to integrate a force respawn into it. i’ve tried something like:
players = game:GetService("Players")
player = players.LocalPlayer
player:LoadCharacter()
but it didn’t work
here’s the full script:
local mapfolder = game.Lighting.Maps
local maps = mapfolder:GetChildren()
local roundtime = script.RoundTime
local musicFolder = game.Lighting.Music
while true do
print ("loop starting")
local chosenmap = maps[math.random(1,#maps)]
local currentmap = chosenmap:Clone()
currentmap.Parent = game.Workspace
currentmap:MakeJoints()
local music = musicFolder[chosenmap.Name]:Clone()
music.Parent = workspace
music:Play()
print (chosenmap.Name)
print ("was chosen!")
print (music.Name)
print ("music is now playing!")
print("now initating a 5 minute wait till next round")
wait(10)
print("map destroyed, restarting loop")
currentmap:Destroy()
music:Destroy()
end
thanks for reading!