Why is my ModuleScript breaking my game?

I have a ModuleScript handling tycoon purchasing functions in my game. It handles the cloning of objects, and placing bought objects into the tycoon’s system.

I was doing a system where an arrow would show where a player bought an object, however, this system only works for the first player to buy anything in the game, and then breaks it for every player after, where they can’t buy anything.

The code works where it is supposed to place the billboard GUI, with the adornee on the primary part of the object bought, into the player’s PlayerGui, so they are the sole player who can see it. Here’s the code snippet:

local guis = game.ServerStorage:WaitForChild("gui"):Clone()
local Debris = game:GetService("Debris")

if BaseModules[Tycoon][ItemName].PrimaryPart then
	guis.Active = true
	guis.Adornee = BaseModules[Tycoon][ItemName].PrimaryPart
	guis.Parent = Player.PlayerGui
	Debris:AddItem(guis, 6)
end

Here’s the in-game output it gave:


(In the output, line 144 is guis.Parent = Player.PlayerGui, and the TycoonHandler part is where the output from TycoonModule goes)

Does anyone know what the issue/solution is?

Please do not make duplicate threads - it is against the forum’s rules

It’s probably because the guis object got destroyed, are you sure you’re not destroying it?

oops. You’re right. Placed the gui definition on the wrong line.

As for the duplicate post, my bad. I realized that I posted in the wrong topic, deleted that one (but I guess the post technically remained) and posted here.

Thanks.