Sorry if the title is confusing
while true do wait(.6) for i, v in pairs(game.Players:GetPlayers()) do if (v.Character.HumanoidRootPart.Position - new.Position).magnitude <= (35) then if v.Character:FindFirstChild("Mask")or v.Character.Humanoid.Health == 0 then else if v.PlayerGui:FindFirstChild("FlashGUI") then else local newclone = clone:Clone() newclone.Parent = v.PlayerGui newclone.pos.Value = new.Position newclone.LocalScript.Disabled = false newclone.me.Disabled = false end end end end end
This is my code it works but if the flashgui gets destroyed it wont get added back
To detect when a GUI is removed from a player's PlayerGui put a LocalScript in StarterPlayer >> StarterPlayerScripts and write this code in it:
local player = game.Players.LocalPlayer local playerGui = player.PlayerGui -- Player Gui is where all GUIs go from StarterGui. playerGui.ChildRemoved:Connect(function(object) if object.Name == "GuiName" then -- Do something. end end) -- The 'object' argument referring to the instance that is being removed.