I am creating a pairing system. Whenever a player requests to pair, it fires a remote event to the player who triggered the proximity prompt and opens a GUI with two choices. When the player selects a choice, it fires it back to the server and functions accordingly. Though, when the player creates a pairing request and then it expires, and then the player requests another time, the other player receives the request one more time. For example, player 1 wants to pair up with player 2, but the request expires (deletes), then player 1 requests again, it creates 2 requests for some reason, then if those expire, it creates 3 the next time. I need help. Here is the relevant code:
if plr:WaitForChild("Paired").Value == "" then -- checks if the requested player isn't paired yet
game.ReplicatedStorage.SendInfo:FireClient(plrWT, plr) -- fires to the player who triggered the prompt, and it sends the player who they want to pair up with through the event
end
game.ReplicatedStorage.SendInfo.OnClientEvent:Connect(function(plr)
script.Parent.Parent.Enabled = true -- GUI enables
print('r!')
for _, child in ipairs(script.Parent:GetChildren()) do -- loops through the children of the frame, the frame has 2 text button children, these are the possible choices that the player can choose
if child:IsA("TextButton") then
child.Activated:Connect(function()
game.ReplicatedStorage.SendInfo:FireServer(plr, child.Name) -- if a choice is selected, it fires back to the server
print("S!")
script.Parent.Parent.Enabled = false -- turns on the gui again
return
end)
end
end
end)
Again, for some reason, the requests a player receives after their request expires keeps increasing by 1. Why?