A weird thing happens when I put the function :help or :Help it Skips it's own command and does the command of the one with the similar name :RemoveHelp, Kinda the same thing happens with the DisableDefaultChat Command on the first attempt it works properly but when I try EnableDefaultChat on the second attempt it does both commands when I only commanded it to do only 1 command. Is there anything wrong with my script that's causing this cause I'm starting to think this is a roblox glitch.
Here's the full script, you can test the :help and :remove Help functions without the Remote function part that :DisableDefaultChat uses. Also Btw this is a custom chat i'm making.
local MainPlayer = game.Players.LocalPlayer
local TextChatBox = script.Parent
local MainChatBox = TextChatBox.Parent
local Chat = MainChatBox.Parent
local ScrollingChatFrame = MainChatBox.ScrollingChatFrame
local TextBox = TextChatBox.TextBox
local TextLabel = ScrollingChatFrame.TextLabel
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local KenChatFolder = ReplicatedStorage:FindFirstChild("KenChatFolder")
local UserIndex = MainChatBox.Parent:FindFirstChild("UserIndex")
local ChatSource = KenChatFolder.ChatSource
local FunctsFolder = ChatSource.FunctsFolder
local ConfirmMessage = UserIndex.ConfirmMessage
local TextMessage = ConfirmMessage.TextMessage
local MainPlayerName = "[" .. MainPlayer.Name .. "]: "
local ChatBox
local TextChanging = true
function CommandLine(Text, ExecutedText, bool)
if Text == ExecutedText then
if ExecutedText == ":help" or ":Help" then
SystemCommandChat("help", true)
end
if ExecutedText == ":RemoveHelp" or ":Removehelp" then
SystemCommandChat("RemoveHelp", true)
end
if ExecutedText == ":DisableDefaultChat" then
SystemCommandChat("DisableDefaultChat", true)
end
if ExecutedText == ":EnableDefaultChat" then
SystemCommandChat("EnableDefaultChat", true)
end
SystemCommandChat("",false) -- I did this to see if it would fix my problem
print(ExecutedText)
end
end
function SystemCommandChat(Command, bool)
local DefaultChatEnablement = FunctsFolder.DefaultChatEnablement
if Command == "help" and bool == true then
TextLabel.Text = "You need Help?"
bool = false
end
if Command == "RemoveHelp" and bool == true then
TextLabel.Text = "Ken's Chat"
bool = false
end
if Command == "DisableDefaultChat" and bool == true then
TextMessage.TypeOfMessageid.Value = 5
if TextMessage.TypeOfMessageid.Value == 5 then
TextMessage.TypeOfMessageid.Value = 0
UserIndex.Visible = true
ConfirmMessage.Visible = true
TextMessage.Text = "Are you sure you want to disable the Default Chat?"
TextMessage.Confirm.MouseButton1Click:connect(function()
print(Command)
DefaultChatEnablement:InvokeServer(false)
end)
end
bool = false
end
if Command == "EnableDefaultChat" and bool == true then
TextMessage.TypeOfMessageid.Value = 6
if TextMessage.TypeOfMessageid.Value == 6 then
TextMessage.TypeOfMessageid.Value = 0
UserIndex.Visible = true
ConfirmMessage.Visible = true
TextMessage.Text = "Are you sure you want to enable the Default Chat?"
TextMessage.Confirm.MouseButton1Click:connect(function()
print(Command)
DefaultChatEnablement:InvokeServer(true)
end)
end
bool = false
end
end
UserInputService.InputBegan:connect(function(key, bool)
if bool == false and key.KeyCode == Enum.KeyCode.Period then
TextBox.Text = ""
end
ChatBox = TextBox.Text
if bool == false and key.KeyCode == Enum.KeyCode.Return then
if TextChanging == true then
local FinishedText = ChatBox
local AllSCF = MainPlayer.PlayerGui.KenChat.MainChatBox.ScrollingChatFrame
local NewTextLabel = TextLabel:Clone()
NewTextLabel.Parent = AllSCF
NewTextLabel.Name = "UniqueTextLabel"
NewTextLabel.Text = MainPlayerName .. FinishedText
CommandLine(ChatBox, FinishedText)
print(ChatBox)
end
end
end)
-- needs a serverside fix

2 comments
That did fix the first portion of my answer, but the second one still can't figure out what goes wrong
i figured out the problem i tried using :SetCoreGuiEnabled on a script not a local script. thanks