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

How to fix gui stacks? [closed]

Asked by 10 years ago

I am making a chat gui and everything works perfectly but when 2 players spam the chat can overlap? Any way to fix this?

001print("New Server")
002--Variables--
003Settings = {
004    Enabled = true --Chat Enabled--
005    ,ServerResponseColor = "Cyan" --Server Text--
006    ,PlayerChatColor = "White" --Color players text is--
007    ,ShowRankInGroup = {false, 7} --Example Goldgrilz7 [Leader]: Hey guys!--
008    ,Admins = {"Goldgrilz7", 7}
009}
010 
011--Only change anything below this line if you know what you're doing--
012 
013function cleantable() --Wipes clean all chat history auto updates players--
014print("Cleaning Table")
015gui = script.Chat.Chat:GetChildren()
View all 132 lines...

Locked by JesseSong

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
coo1o 227 Moderation Voter
10 years ago

Well, I made a chat once and I had the same problem. To fix it, I made a debounce. It's something like this:

01local ready = true --the debounce
02 
03function chat() --function that adds messages to the chat
04    ready = false
05    --chat code
06    ready = true
07end
08 
09player.Chatted:connect(function() --you can use a named function, but I'm using an anonymous function
10    repeat wait(0) until ready --a repeat loop; if ready (the debounce) is false, it will keep waiting one frame (wait(0)) until ready is true again
11    chat() --call your chat function
12end)

So basically, the ready variable will always be true until the chat function is called. ready will remain false until the call function finishes.

It might be different for your chat, but that is how I prevented 'chat-overlap' in my custom chat.

Hoped I helped.

~coo1o

Ad
Log in to vote
0
Answered by 8 years ago

If you are wanting to make it so when there is one gui already open, and someone trys to reopen it the current gui goes away and the new one appears, here is the solution


Name = "GUINAMEINHERE" if player.PlayerGui:FindFirstChild(Name) then game.Debris:AddItem(player.PlayerGui[Name],0)

end