Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

don't clone if the player already has?

Asked by 6 years ago

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.

01local debounce = false
02local Players = game:GetService("Players")
03local storage = game:GetService("ServerStorage")
04local aaaa = storage.aaaa
05script.Parent.Touched:Connect(function(hit)
06 
07 
08 
09    local player = Players:GetPlayerFromCharacter(hit.Parent)
10    if player.PlayerGui.aaaa then
11        print("already has")
12 
13    else
14    if not debounce then
15        debounce = true
View all 24 lines...
0
Do elseif not player.PlayerGui:FindFirstChild(‘aaaa’) then MaxDev_BE 55 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
01local debounce = false
02local Players = game:GetService("Players")
03local storage = game:GetService("ServerStorage")
04local aaaa = storage.aaaa
05script.Parent.Touched:Connect(function(hit)
06 
07 
08 
09    local player = Players:GetPlayerFromCharacter(hit.Parent)
10    local guicheck = player.PlayerGui:FindFirstChild(aaaa)
11    if guicheck then
12        print("already has")
13 
14    else
15 
View all 22 lines...
0
this clones it more than once retracee 68 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Change line 10 to:

1if player.PlayerGui:FindFirstChild("aaaa") == true then
0
This should work. SBlankthorn 329 — 6y

Answer this question