#Chat messages overlay each other

145 messages · Page 1 of 1 (latest)

sage bear
#

Chat messages overlay each other

frosty nest
#

can I see the script?

sage bear
#

Yeah, one moment

frosty nest
#

is there anything that is supposed to make it move up? or it's just this way?

sage bear
frosty nest
#

do you want it to move up or just fade?

sage bear
#

Just fade out

frosty nest
#

is the local script parent the message?

#

or screengui?

sage bear
#

It’s parented to the frame of the ScreenGui

frosty nest
#

Alright, Editing the script

sage bear
#

Alright, no rush. I appreciate the assistance.

cursive oceanBOT
#

studio** You are now Level 2! **studio

frosty nest
#

Can I see the AvatarChatDisplayHUD children to make the fade part more accurate?

sage bear
#

This, correct?

frosty nest
#

yeah it's good

sage bear
#

Alrighty

frosty nest
#

tell me if you find any errors

sage bear
#

Alright

frosty nest
#

oh wait there is a typo in it

#

in this part of the code:

if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
#

i wrote AvatarChatDisplatHUD, change it to AvatarChatDisplayHUD

sage bear
#

So, I tested that one and it only displays the first message.

sage bear
frosty nest
#

Errors?

sage bear
frosty nest
#

No errors then

frosty nest
sage bear
sage bear
frosty nest
#

ooh

#
if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
        local chatmessage = chatScrollBox.AvatarChatDisplayHUD

        for i, k in pairs(chatmessage:GetDescendants()) do
            if k:IsA("GuiObject") then
                    if k:IsA("ImageLabel") or k:IsA("ImageButton") then
                        local BackG = TweenService:Create(k, TwInfo, {BackgroundTransparency = 1})
                        local Image = TweenService:Create(k, TwInfo, {ImageTransparency = 1})
                        Image:Play()
                        
                        if k:IsA("Frame") or not k:IsA("Frame") then
                           BackG:Play()
                        end
                    end
                    
                    if k:IsA("GuiButton") then
                        local TextAndBack = TweenService:Create(k, TwInfo, {Transparency = 1})
                        TextAndBack:Play()
                    end
            end
        end
    end

Change this part of the code to this one above

sage bear
#

It still wants to overlap it seems

frosty nest
#

any errors?

#

oh

#

but yeah any errors?

sage bear
frosty nest
#

add a print("Message Detected") below this line of code:

if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
#

then tell me if it's printing or not

sage bear
#

Just like this?

sage bear
frosty nest
#

yes

#
if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
        print("Message Detected")
        local chatmessage = chatScrollBox.AvatarChatDisplayHUD

        for i, k in pairs(chatmessage:GetDescendants()) do
                    if k:IsA("ImageLabel") or k:IsA("ImageButton") then
                        local BackG = TweenService:Create(k, TwInfo, {BackgroundTransparency = 1})
                        local Image = TweenService:Create(k, TwInfo, {ImageTransparency = 1})
                        Image:Play()
                        
                        if k:IsA("Frame") or not k:IsA("Frame") then
                           BackG:Play()
                        end
                    end
                    
                    if k:IsA("GuiButton") then
                        local TextAndBack = TweenService:Create(k, TwInfo, {Transparency = 1})
                        TextAndBack:Play()
                    end
        end
    end

replace it

sage bear
#

I get this, and it doesn't allow me to send a message.

cursive oceanBOT
#

studio** You are now Level 3! **studio

frosty nest
#

you probably added an extra end to the code

#
local function AddMessageToScrollBox(playerName, message)
    
    if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
        print("Message Detected")
        local chatmessage = chatScrollBox.AvatarChatDisplayHUD

        for i, k in pairs(chatmessage:GetDescendants()) do

                    if k:IsA("ImageLabel") or k:IsA("ImageButton") then
                        print("Image1")
                        local BackG = TweenService:Create(k, TwInfo, {BackgroundTransparency = 1})
                        local Image = TweenService:Create(k, TwInfo, {ImageTransparency = 1})
                        Image:Play()
                        print("Image2")
                        if k:IsA("Frame") or not k:IsA("Frame") then
                           BackG:Play()
                        end
                        print("FrameOrImage")
                    end
                    
                    if k:IsA("GuiButton") then
                        local TextAndBack = TweenService:Create(k, TwInfo, {Transparency = 1})
                        TextAndBack:Play()
                        print("Label")
                    end    
        end
    end
    
    local MessageUI = ReplicatedStorage:FindFirstChild("AvatarChatDisplayHUD"):Clone()
    MessageUI.Parent = chatScrollBox
    MessageUI.ChatFrame.NameAndTime.PlayerNameLabel.Text = playerName .. " "
    local currentTime = os.date("*t")
    local formattedTime = string.format("%d:%02d %s", (currentTime.hour % 12 == 0) and 12 or currentTime.hour % 12, currentTime.min, (currentTime.hour >= 12) and "PM" or "AM")
    MessageUI.ChatFrame.NameAndTime.TimeLabel.Text = formattedTime
    MessageUI.ChatFrame.MessageLabel.Text = message
end
#

replace the function AddMessageToScrollBox with this:

sage bear
sage bear
frosty nest
#

No

#

just select the whole local function

#

and paste it

sage bear
#

Okay, so, replace what I have highlighted then?

#

I do apologize, I'm not too familiar with the scripting part, just environmental parts.

frosty nest
#

The whole function, until its end

#

but it worked

#

and did it dissapear?

sage bear
#

It's still overlapping the past messages with the current one

frosty nest
#

oooh

#

I just realized what's wrong

#
if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
        print("Message Detected")
        local chatmessage = chatScrollBox.AvatarChatDisplayHUD
        chatmessage:Destroy()

    end

Try this one first

#

just to test something

sage bear
#

Alright, sorry i'm on a phone call.

#

Am I missing anything here?

frosty nest
#

remove the for loop

sage bear
#

The for loop is until the 3rd end?

frosty nest
#

yes

sage bear
#

Alright

#

Doesn't let me send the message

frosty nest
#

errors?

sage bear
frosty nest
#

there's an ending missing

#

replace this with this:

local function AddMessageToScrollBox(playerName, message)
    
    if chatScrollBox:FindFirstChild("AvatarChatDisplayHUD") then
        print("Message Detected")
        local chatmessage = chatScrollBox.AvatarChatDisplayHUD
        chatmessage:Destroy()

    end
    
    local MessageUI = ReplicatedStorage:FindFirstChild("AvatarChatDisplayHUD"):Clone()
    MessageUI.Parent = chatScrollBox
    MessageUI.ChatFrame.NameAndTime.PlayerNameLabel.Text = playerName .. " "
    local currentTime = os.date("*t")
    local formattedTime = string.format("%d:%02d %s", (currentTime.hour % 12 == 0) and 12 or currentTime.hour % 12, currentTime.min, (currentTime.hour >= 12) and "PM" or "AM")
    MessageUI.ChatFrame.NameAndTime.TimeLabel.Text = formattedTime
    MessageUI.ChatFrame.MessageLabel.Text = message

    --local TextLabel = Instance.new("TextLabel")
    --TextLabel.Parent = chatScrollBox
    --TextLabel.Text = message
    --TextLabel.TextSize = 14
    --TextLabel.TextWrapped = true
    --TextLabel.Size = UDim2.new(1, 0, 0, TextLabel.TextBounds.Y) -- Adjust height based on text size
    --TextLabel.TextXAlignment = Enum.TextXAlignment.Left
    --TextLabel.BackgroundTransparency = 1
    --TextLabel.TextTransparency = 0
    --TextLabel.TextColor = Color3.fromRGB(255, 255, 255)
end
sage bear
#

Alright, I've done that, and this is the result.

frosty nest
#

did it overlap?

sage bear
#

It doesn't send the message

frosty nest
#

It's hard to tell what's wrong if i'm not editing the system :/, I don't know what else could be wrong

#

alright so I got another solution

sage bear
#

Alright, well one last thing I can do is just send a short video of what's all here and if you'd like to take a look at the scripts, properties, I can provide them. If that's easier?

frosty nest
#

when I didn't edit it

#

Now make a local script inside the AvatarChatDisplayHUD

#

did you do it?

frosty nest
# frosty nest Now make a local script inside the AvatarChatDisplayHUD

when you do it, copy and paste this code into the localscript:

local GUI = script.Parent
local SendMessageRE = ReplicatedStorage:WaitForChild("SendMessageRE")

local function Fading()
    print("Deleting message...")
    if GUI.Parent ~= ReplicatedStorage then
       GUI:Destroy()        
    end
    
end

SendMessageRE.OnClientEvent:Connect(Fading)
sage bear
sage bear
frosty nest
#

what does the error say?

sage bear
cursive oceanBOT
#

studio** You are now Level 4! **studio

frosty nest
#

ooh

#

forgot to set replicated storage

#

change it to:

local SendMessageRE = game:GetService("ReplicatedStorage"):WaitForChild("SendMessageRE")

sage bear
frosty nest
cursive oceanBOT
#

studio** You are now Level 18! **studio

frosty nest
#
local GUI = script.Parent
local Storage = game:GetService("ReplicatedStorage")
local SendMessageRE = Storage:WaitForChild("SendMessageRE")

local function Fading()
    print("Deleting Message")
      if GUI.Parent ~= Storage then
          GUI:Destroy()
      end
end

SendMessageRE.OnClientEvent:Connect(Fading)
#

replace all the code with it

sage bear
#

So that removes the GUI when I hit enter upon sending a message

frosty nest
#

yeah

#

if it works, then i'll add the fading effect

sage bear
#

I see

frosty nest
#

so, did it work?

sage bear
#

Sorry, no, it still overlapped

frosty nest
#

did it print the message?

sage bear
frosty nest
#

try this one

sage bear
#

So it sends the message, waits then removes it, but it also removes the chat box and bottom icon below

frosty nest
#

Can you send me a screenshot of the Gui's?

sage bear
#

As in what it does after using that code, or just the GUI itself?

frosty nest
#

the GUI itself

#

I need to know what the message pop up is exactly

#

if it is a certain frame, etc

sage bear
#

Okay, so these are the GUI's and I'll send you the video with the code applied

frosty nest
#

select all the Gui Objects that is the pop up

sage bear
#

I’m not following, do you mean select all the children of both GUIs?

frosty nest
#

yeah, like this:

#

then highlight the parts from the pop up message

sage bear
#

If this is what you mean, here are these

frosty nest
#

alright, this time highlight just this part:

#

oh wait

#

is the localscript under AvatarChatDisplay?

#

and here's an updated version:

local GUI = script.Parent
local Storage = game:GetService("ReplicatedStorage")
local SendMessageRE = Storage:WaitForChild("SendMessageRE")

local function Fading()
    if GUI.Parent ~= Storage then
        print("Message deleted")
        GUI:Destroy()
    end
end

SendMessageRE.OnClientEvent:Connect(function()
    task.delay(0.1, Fading)
end)
sage bear
sage bear
frosty nest
#

...

#

Yes, that's where it is supposed to be

frosty nest
#

copy it again

sage bear
#

My bad, let me switch that

frosty nest
#

Alright

sage bear
#

The results

frosty nest
#

sweet

sage bear
#

Now I just have to test and see if works with somene, I appreciate the time you spent helping with this