i want to make this script where if the player already has this gui in it's playergui then don't clone it, but if the player doesn't then you do clone it. But this script doesn't work.
local debounce = false local Players = game:GetService("Players") local storage = game:GetService("ServerStorage") local aaaa = storage.aaaa script.Parent.Touched:Connect(function(hit) local player = Players:GetPlayerFromCharacter(hit.Parent) if player.PlayerGui.aaaa then print("already has") else if not debounce then debounce = true aaaa:Clone().Parent = player.PlayerGui print("cloned gui") wait(99999999999999999999999999999999999999999999999999999999999999999999) debounce = false end end end)
local debounce = false local Players = game:GetService("Players") local storage = game:GetService("ServerStorage") local aaaa = storage.aaaa script.Parent.Touched:Connect(function(hit) local player = Players:GetPlayerFromCharacter(hit.Parent) local guicheck = player.PlayerGui:FindFirstChild(aaaa) if guicheck then print("already has") else aaaa:Clone().Parent = player.PlayerGui print("cloned gui") end end end)
Change line 10 to:
if player.PlayerGui:FindFirstChild("aaaa") == true then