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.