I am not using this for any practical purposes or anything, this is just a test, just wanted to make this clear.
So, what I am making is that I am making sort of a command where if a user says “/chatlogs”, a GUI appears showing them the chatlogs.
This requires 3 scripts, the one for the /chatlogs command, the one that logs the chats and puts them in the GUI, and the one for the close button.
Script 3 does work, however it’s not the same with scripts 1 or 2.
Honestly I don’t even know what i’m doing wrong here, no errors in the output or anything, just that it doesn’t seem to work.
All scripts are LocalScripts, and I tried this with regular Scripts as well and it still doesn’t work. Here are the scripts:
Script 1:
chatlogs = script.Parent.chatlogs
local function onMessageReceived(player, message)
if message == "/chatlogs" or message == "/Chatlogs" or message == "/ChatLogs" or message == "/CHATLOGS" then
chatlogs.Visible = true
game.Lighting.Blur.Enabled = true
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
onMessageReceived(player, message)
end)
end)
Script 2:
function getTime()
local year = os.date("%y")
local month = os.date("%m")
local day = os.date("%d")
local hour = os.date("%I")
local minute = os.date("%M")
local second = os.date("%S")
local amorpm = os.date("%p")
return day.. "/" ..month.. "/" ..year.. ", " ..hour.. ":" ..minute.. ":" ..second.. " " ..amorpm
end
main = script.Parent
main.TextLabel.Text = ""
local function onMessageReceived(player, message)
main.TextLabel.Text = "[" .. getTime() .. "] " .. player.Name .. " says: \"" .. message .. "\"" .. "\n" .. main.TextLabel.Text
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
onMessageReceived(player, message)
end)
end)
Script 3 (this one does work):
close = script.Parent
chatlogs = script.Parent.Parent.Parent
close.MouseButton1Click:Connect(function()
chatlogs.Visible = false
game.Lighting.Blur.Enabled = false
end)
I tried putting the scripts into Assistant, but then it just gave me the most unhelpful response ever (bruh). Then I tried searching the output tab to see if there was any errors, no errors, so apparently this works without any errors, but when i use this, it just doesn’t work.