This is my roundscript. i made a function called TeleportPlayer that would teleport everyone to different positions in the game based on the position of parts in a folder. This script was working fine until I wrote this. The GUIs wont work but the tween and music will play, what did I do wrong? I dont see any errors in the Output.
local lobby = workspace.Lobby
local map = game.ReplicatedStorage.Maps.Map
local status = workspace.Values.Status
local inRound = workspace.Values.InRound
local backgroundSound = game.SoundService['2D'].Background
local intermission = workspace:WaitForChild("Lobby").Intermission.Sound
local puffs = workspace:WaitForChild("Lobby").Handle.Sound
intermission:Play()
intermission.Looped = true
puffs:Play()
puffs.Looped = true
while wait() do
if inRound.Value == true then
return
end
for i = 15, 0, -1 do
status.Value = i
wait(1.0)
end
intermission:Stop()
puffs:Stop()
inRound.Value = true
lobby:Destroy()
local clone = map:Clone()
clone.Parent = workspace
local teleportFolder = workspace:WaitForChild("Map").PlayerSpawns
local teleportParts = teleportFolder:GetChildren()
local Players = game:GetService("Players")
local function TeleportPlayer(player)
if player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local randomSpawn = math.random(1, #teleportParts)
local chosenSpawn = teleportParts[randomSpawn]
player.Character.HumanoidRootPart.CFrame = chosenSpawn.CFrame
end
end
for _, player in ipairs(Players:GetPlayers()) do
TeleportPlayer(player)
end
local floorValue = workspace.Values.FloorValue
floorValue.Value = floorValue.Value + 1
local gui = game:GetService("StarterGui").Lobby.Intermission
gui.Enabled = false
local floorGui = game:GetService("StarterGui").InGame.Floor
floorGui.Enabled = true
local HealthBar = game.StarterGui.InGame.LocalHealth
HealthBar.Enabled = true
local Crystal = game.StarterGui.InGame.Crystal
Crystal.Enabled = true
local TweenService = game:GetService("TweenService")
local part = workspace:WaitForChild("Map").Elevator.Door
local endPosition = Vector3.new(112, -15.5, 99)
local tween = TweenService:Create(part, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Position = endPosition})
tween:Play()
backgroundSound:Play()
script.Enabled = false
end