So, I was working on the magic game "Elemental Magic", I was planning a magic called Sand Magic to have full spell moveset in a GUI, then it works. Suddenly this is the hardest part, cloning it to the PlayerGui.
local UIS = game:GetService("UserInputService") local s = true local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() local gui = player:WaitForChild("PlayerGui") script.Parent.Equipped:Connect(function() local sand = script.Parent.Handle:WaitForChild("Sand") sand.Parent = gui sand.Enabled = true script.Parent.Unequipped:Connect(function() sand.Parent = script.Parent.Handle end) end)
I tried the Destroy method, instead it errors the GUI by the spells not making it do it.
But you have to reuse "sand" so it doesn't make sense if you destroy it forever. Prefer to use the:
local Debris = game:GetService("Debris") local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() local gui = player:WaitForChild("PlayerGui") local sand = script.Parent.Handle:WaitForChild("Sand"):Clone local sand.Name = "Sand" sand.Parent = gui script.Parent.Unequipped:Connect(function() Debris:AddItem(sand, 5) end)