Odd error message when trying to change parent of GUI

I’m making a game with a spectator mode. There’s a board in the lobby you click which puts you into spectator mode so you can watch other players. However, when parenting the GUI that handles spectator mode, I get this error message:

This is the code for the board that the player clicks:

local canSpectate = true
local spawns = game.Workspace.Assets.SpawnIsland.Spawns:GetChildren()

    script.Parent.ClickDetector.MouseClick:Connect(function( player)
    if not canSpectate then return end

    local hum = player.Character:FindFirstChild("Humanoid")

    if hum ~= nil then
	    canSpectate = false
	    local randomSpawn = spawns[math.random(1, #spawns)]
	    local speccy = game.ServerStorage.SpectateGui:Clone()
	
	    speccy.Parent = player.PlayerGui
	    speccy.Spectate_Script.Disabled = false
	
	    hum.Parent:MoveTo(randomSpawn.Position)

         wait(1)
         canSpectate = true
                 
    end
end)

I don’t believe the warning is originating from the code snipet above, could you show the full code possibly? Also this is a warning not an error and shouldn’t be catastrophic for your code, it shouldn’t interrupt your overall functionality.

Also my experience with this warning is usually when trying to set the parent of something to two different objects at the same time, so make sure that you don’t have two separate threads that are trying to make a change at the same time.

This IS the full code

local canSpectate = true
local spawns = game.Workspace.Assets.SpawnIsland.Spawns:GetChildren()

script.Parent.ClickDetector.MouseClick:Connect(function( player)
    if not canSpectate then return end

    local hum = player.Character:FindFirstChild("Humanoid")
    local alreadyThere = player.PlayerGui:FindFirstChild("SpectateGui")

    if hum ~= nil and alreadyThere == nil then
	    canSpectate = false
	    local randomSpawn = spawns[math.random(1, #spawns)]
	    local speccy = game.ServerStorage.SpectateGui:Clone()
	
	    speccy.Parent = player.PlayerGui
	    speccy.Spectate_Script.Disabled = false
	
	    hum.Parent:MoveTo(randomSpawn.Position)
	
	    wait(1)
	
	    canSpectate = true
    end
end)

It doesn’t break anything per se. The player can just click on it again and it works. For some reason, it usually only happens the first time a player spawns. But players reported this as a bug and it bothers me. Any way to fix?

There’s nothing else moving it around. This is the only script in the game that moves the parent of this GUI.

So how do you get out of the spectate?

Let me check that real quick. While typing this out, I realized that it was only destroying itself locally (from a close button in the spectate GUI)

I’m dumb, that was it. It was attempting to do something with the parent locally. Previously, trying to exit spectate only deleted the SpectateGui locally, and then they’d pile up in playerGui