Issues with GUI Cloning

So I’ve been working on a side project for a little while and stumbled across an issue with my GUI:Clone()
What’s meant to happen is you click a monster and then your equipped wand (the wand part works) move set is supposed to show up on screen to fight said monster. The issue is the Default wand GUI is showing up instead of the equipped wand GUI. I’ve tried many different ways of getting the equipped one but am having trouble getting it to work.
The current script is as follows, (Notes - It’s a ClickDetector with a Script [Not a local script] inside it, also I’ll show what works and doesn’t)

script.Parent.MouseClick:Connect(function(player)
local crystals = player:FindFirstChild("leaderstats"):WaitForChild("Crystals")
local ph = player.Character.Humanoid
ph.WalkSpeed = 0
local CM = player:FindFirstChild("CurrentMob")
CM.Value = script.Parent.Parent
local hum = script.Parent.Parent.Humanoid
hum.WalkSpeed = 0
local t = CM:FindFirstChild("Type")
t.Value = "Land"
-- Above Works want to look at the rest
local gui = player:FindFirstChild("PlayerGui")
	local equipped = player:FindFirstChild("EquipedWand") 
	local e = equipped:FindFirstChild("Equiped")
	local wand = equipped:FindFirstChild(e.Value)
	local bg = wand:FindFirstChild("BattleGui")
	local cGui = bg:Clone()
	cGui.Parent = gui
ph.Died:Connect(function()
	cGui:Destroy()
	CM.Value = nil
	t.Value = ""
	hum.WalkSpeed = 5
end)
hum.Died:Connect(function()
	CM.Value = nil
	t.Value = ""
	cGui:Destroy()
	ph.WalkSpeed = 16
	crystals.Value = crystals.Value + math.random(10,25)
end)
end)

My theory is the script.Parent.MouseClick isn’t updating to the current wand as the new wand is showing up with the correct values but the script resorts to the default BattleGui. I’ve tried to figure it out but cannot get it to work. Any help is appreciated, thanks in advanced,
-Notrealac0unt

EDIT: To make clear “BattleGui” is the name for all the GUI’s in the wand.

Your problem is that all the Guis have the same name so it just picks the first one. Say I have a model and 4 parts all called “Part”. If I do FindFirstChild(“Part”) then one of the parts will be picked and I do not know which one will be picked. You gotta have your BattleGuis have different names such as BattleGui1 and BattleGui2 or something.

It still won’t work. I changed it to different names which it still clones but when the wand is changed it still uses the default. Shouldn’t script.Parent.MouseClick:Connect(function(player) always update when clicked?

How are you setting the equipped wand or battlegui?

If you are doing it on the client, it won’t update to the server (nor other clients) because of Roblox’ Client-Server Model.

If this is the reason it gives you the default gui then you only have to move the code that sets the wand/battlegui from the localscript to a script.

Thank you, that was the solution, equiping wands script was a local script, converted to a script works perfectly now! Thanks!