Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my DataStore working? [CLOSED]

I'm currently trying to create a Cross-Server-Chatting to find out what's possible using DataStores. But now I'm meeting an error that is making no sense to me. This here is a ModuleScript in ServerStorage called "Chat". It's simple and I'm seeing no mistake in it.

local Chat = {}

Server = game:GetService("DataStoreService"):GetDataStore("Server")

function Chat:SMTS(msg,client)
	local continue = true
	local n = 1
	while continue == true do
		print("continuing")
		if Server:GetAsync("MSG."..n) ~= nil then
			print("another one!")
			n=n+1
		elseif Server:GetAsync("MSG."..n) == nil then
			print("stopping")
			continue = false
		end
		wait()
	end
	print("Time to send the message to the server!")
	Server:SetAsync("MSG."..n, "["..client.."]: "..msg)
end

return Chat

Now I've been testing this entire thing a few times already, but it's always doing the same: Nothing. There's no error shown or so, but also nothing like printing or text changing. I've ended up confused about what's wrong and am in need of some proffessional help. Thanks in advance!

2 answers

You're only returning a table value on line 23, you're not actually calling the function.

Change line 23 to return Chat.SMTS()

3 comments

0

But that's how any other of my Module Scripts work.

0

Also I can receive the function from any other script and even the console, but it's just not reacting. By the way, it was the DataStoreService being as fast as a snail yesterday.

0

I didn't know you were using a module script

This discussion is preserved as it was. New answers, comments, and votes are closed.