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

This custom chat doesn't work in real server.?

Asked by 7 years ago
Edited by M39a9am3R 7 years ago

This is located in starter gui.It's a local script

local rep = game:GetService('ReplicatedStorage')
local startergui = game:GetService('StarterGui')
local uis = game:GetService('UserInputService')
local plrs = game:GetService('Players')
local chatevent = rep:WaitForChild('ChatRemote')
local client = plrs.LocalPlayer
local mouse = client:GetMouse()
local chatbar = script.Parent
local chatframe = chatbar.Parent
local chats = {}
uis.InputBegan:Connect(function(key)
    if key.KeyCode == Enum.KeyCode.Slash then
        chatbar:CaptureFocus()
    end
end)
local function pushmessage(size)
    for i,v in pairs(chats) do
        v.Position = v.Position - UDim2.new(0,0,0,size)
        if v.Position.Y.Offset < -chatframe.AbsoluteSize.Y then
            chats[i] = nil
            v:Destroy()
        end

    end
end
local function createmessage(message, speaker)
    local label = Instance.new('TextLabel')
    label.BackgroundTransparency = 1
    label.TextXAlignment = 'Left'
    label.TextColor3 = Color3.fromRGB(255, 239, 10)
    label.Font = Enum.Font.Code
    label.FontSize = Enum.FontSize.Size18
    label.Size = UDim2.new(0.8,0,0,20)
    label.Position = UDim2.new(0,0,1,-25)
    label.Text = tostring(speaker)..':'..message
    label.TextScaled = true
    pushmessage(label.Size.Y.Offset)
    chats[#chats+1] = label
    label.Parent = chatframe
    local wordList = {
    "null"; --Content removed by moderators.
    "null"; --Content removed by moderators.
    "null"; --Content removed by moderators.
   "noob";
   "Hello";
  "null"; --Content removed by moderators.   "idiot";
   "kick/";
   "ban/";
}
for i,v in pairs(wordList) do
    if chatbar.Text == v then
        label.Text = client.Name..' IS SWEARING'
    end
end

end

chatevent.OnClientEvent:Connect(function(request, message, speaker)
    request = request:lower()
    if request == 'chat' then
        createmessage(message, speaker)
    end
end)




chatbar.FocusLost:Connect(function(enter)
    if enter then
        chatevent:FireServer('chat', chatbar.Text)
        if chatbar.Text == '' then
            return
            end
            chatbar.Text = 'CLICK here or press SLASH to chat'      
    end
end)
startergui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)

this doesn't work in real server

local wordList = {
    "null"; --Content removed by moderators.
    "null"; --Content removed by moderators.
    "null"; --Content removed by moderators.
   "noob";
   "Hello";
   "null"; --Content removed by moderators.
   "idiot";
   "kick/";
   "ban/";
}
for i,v in pairs(wordList) do
    if chatbar.Text == v then
        label.Text = client.Name..' IS SWEARING'
    end
end

Also this script is located in ServerScriptStorage. It's a normal script

local rep = game:GetService('ReplicatedStorage')
local chatevent = rep:WaitForChild('ChatRemote')


chatevent.OnServerEvent:Connect(function(client, request, value)
    request = request:lower()
    if request == 'chat' then
        chatevent:FireAllClients('chat', value, client.Name)
    end
end)
0
Hey man, please check the community guidelines before posting. We understand you're using profane language in terms of the purpose of your script, but we do not allow it on any portion of our physical website. https://scriptinghelpers.org/help/community-guidelines M39a9am3R 3210 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

It doesn't work, because after you fire to the server you clear the chat bar. Also, you are just attempting to clear the chat bar, not the message that everyone gets. My suggestion is just use Roblox's filter. Additionally, you are only checking if the chat bar text is EXACTLY that text. so you could easily bypass it with a character before, after, etc.

Ad
Log in to vote
0
Answered by 7 years ago

the wordlist table should be outside of the function

Answer this question