0
votes

I was making custom chat system and I faced this "bug". just textbox returns "", not nil. and there is no any error. even without

string.len(script.Parent.Parent.message.Text) > 0

"if" part.

    local db = false
    local TextService = game:GetService("TextService")
    script.Parent.MouseButton1Click:Connect(function ()
        local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
        local dn = plr.Character.Humanoid.DisplayName
        local muted = script.Parent.muted.Value
        local mod = script.Parent.moderator.Value
        if db == false and muted == false and string.len(script.Parent.Parent.message.Text) > 0 then
            db = true
            local ts = 16
            local msg = script.Parent.Parent.chat.message0:Clone()
--problem line
            msg.messageContent.Text = TextService:FilterStringAsync(script.Parent.Parent.message.Text, plr.UserId, "2")
            if string.len(script.Parent.Parent.message.Text) > 130 then
                ts = 14
            end
            msg.messageContent.TextSize = ts
--problem ends
            local ps = msg.prefixes
            ps.bot.Visible = false
            local counter = game.ReplicatedStorage.ChatBlockStorage.counter.Value
            msg.Name = "message" .. counter
            msg.actualName.Text = "@" .. plr.Name
            msg.displayName.Text = dn
            msg.icon.Image = game.Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
            msg.icon.ResampleMode = "Default"
            if script.Parent.Parent.message.customIcon.locked.Visible == false then
                msg.icon.Image = "http://www.roblox.com/asset/?id=" .. script.Parent.Parent.message.customIcon.Text
            end
            if msg.Name == "message1" then
                mod = true
            end
            if mod == true then
                ps.mod.Visible = true
            end
            counter += 1
            script.Parent.Parent.message.Text = ""
            wait(game.ReplicatedStorage.ChatBlockStorage.waitTime.Value)
            db = false
        end
    end)

any ideas how to fix it?

at the end of your snippet you assign script.Parent.Parent.message.Text = "" so I cannot make sense of your post. why do you expect something else but "" ?Piglet