function onTouched(hit) if hit.Parent:findFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local gui = game.ServerStorage.PerkShop local guiClone = gui:clone() if not player.PlayerGui:FindFirstChild(guiClone)then guiClone.Parent = player.PlayerGui end end end script.Parent.Touched:connect(onTouched)
Honestly lost now, thought I did this all perfectly. All the help is appreciated!
The line:-
if not player.PlayerGui:FindFirstChild(guiClone)then
Try's to use the object guiClone and not the name of the gui
Simply add Name:-
function onTouched(hit) if hit.Parent:findFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local gui = game.ServerStorage.PerkShop local guiClone = gui:clone() if not player.PlayerGui:FindFirstChild(guiClone.Name)then guiClone.Parent = player.PlayerGui end end end script.Parent.Touched:connect(onTouched)
This is because the method FindFirstChild will not convert the object into a string so the result will be nil allowing for duplicates.