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

Why won't GUI destroy when one value or the other becomes false?

Asked by 5 years ago
Edited 5 years ago

So I have this script that makes it when two values are true meaning that two players are touching two separate blocks (Thanks to SerpentineKing), the function finds the two players hitting the block and adds a GUI into their PlayerGUI. I am now trying to make it so when one of the people aren't touching one of the two blocks anymore, meaning one of the values become false, the GUI is destroyed from both player's PlayerGUI, and then this script will work when both players touch the two blocks again.

01local model = script.Parent
02local connect1 = model:WaitForChild("JoinBlock1")
03local connect2 = model:WaitForChild("JoinBlock2")
04local full1 = connect1:WaitForChild("Full")
05local full2 = connect2:WaitForChild("Full")
06 
07local ss = game:GetService("ServerStorage")
08local start1 = ss:WaitForChild("Start1")
09local start2 = ss:WaitForChild("Start2")
10 
11local player1 = nil
12local player2 = nil
13 
14local function CheckConnection()
15    if player1 and player2 and player1 ~= player2 and full1.Value == true and full2.Value == true then
View all 64 lines...

Answer this question