When the player chooses a character morph, this server script (shown below) makes a ScreenGUI show up on the client's side. It will work perfectly, but if you restart your character and select a morph again, the ScreenGUI doesn't show up at all. I'm pretty certain this has to do with me using FilteringEnabled, but what can I do to make sure it works every time?
local sp = script.Parent
local db = true
local Animations = script.Parent.Animations
sp.Touched:connect(function(hit)
if hit and hit.Parent:findFirstChild("Humanoid") and db then
db = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player.PlayerGui:findFirstChild("Animations") then
Animations:Clone().Parent = player.PlayerGui
end
wait()
db = true
end
end)
I'd appreciate if someone could help.

4 comments
Welp boi, try to use this: [local Animations = script.Parent.Animations:Clone()] - Obviously without the []
Hmm, nope. Didn't solve it.
Maybe you don't destroy the Animations gui when you restart?
Maybe. How would I go about fixing that?