UPDATE: If you have a ModuleScript that errors while loading, it turns out the RemoteFunction will not work. Who woulda thunk it?
I’ve been trying for at least a solid hour or two now to figure out why it’s not working, but when I run :InvokeServer()
on the client, the server doesn’t seem to pick up the invocation.
So far I’ve:
- Checked through every server script I have to make sure two aren’t waiting for the same
.OnServerInvoke
event, which they are not. - I’ve tried moving stuff around and renaming the parent folder, which had no result.
- Deleting and creating new scripts.
I’m running out of things to try atp.
Server Code:
Events.ReturnChatLogs.OnServerInvoke = function(player)
print("Recieved.")
if AdminChecker:ReturnRank(player) >= 1 then
print("player has right rank.")
local chats = ChatLogs:Get()
if chats ~= nil then
return chats
else
return nil
end
else
player:Kick()
end
end
Client Code:
local ChatLogs = script.Parent.ChatLogs
local FullView = script.Parent.FullChat
local disButton = script.Parent.TextButton
local Remotes = game:GetService("ReplicatedStorage").Remotes
local format = "%x %X"
game:GetService("ReplicatedStorage").Remotes.ViewChatLogs.OnClientEvent:Connect(function()
script.Parent.Visible = true
script.Parent.Parent.ModLog.Visible = false
for i,v in ipairs(ChatLogs.ScrollingFrame:GetChildren()) do
if v:IsA("Frame") then
v:Destroy()
end
end
local logs = Remotes.ReturnChatLogs:InvokeServer()
if logs ~= nil then
for i, log in pairs(logs) do
local frame = game:GetService("ReplicatedStorage").Items.ChatFrame:Clone()
frame.Parent = ChatLogs.ScrollingFrame
frame.message.Text = log.Message
local formatted = os.date(format, log.sent)
frame.title.Text = log.SenderName.." | "..formatted
frame.TextButton.MouseButton1Click:Connect(function()
FullView.chat.Text = log.Message
FullView.Timestamp.Text = formatted
FullView.Sender.Text = log.SenderName
end)
end
end
end)
disButton.MouseButton1Click:Connect(function()
script.Parent.Visible = false
end)
Thanks for any help in advance.