How to keep a config into a datastore

  1. What do you want to achieve?
    I want to make a config sit in a datastore then automatically load when a server starts

  2. What is the issue?
    The datastore spits out an error (don’t know which one though)

  3. What solutions have you tried so far?
    Tried moving stuff around.

You will need these three items in the module to help me.
https://www.roblox.com/library/4426299555/lumeyIN-Beta-Module
You should only need to take a look at WelcomeToIN’s Finisher script, The MainModule and the CheckinInstallerHelper.

Thanks for your help!

2 Likes

Can you please post the error and code causing the error?

Hold on, Can you make this spit out different errors so we can figure that out?

local datastoreS = game:GetService("DataStoreService")
local ConfigStore = datastoreS:GetDataStore("lumeyINConfig")
local recheck = nil
script.Parent.Parent.CHECK_API.OnServerEvent:Connect(function(p,data)
	print(data[1],data[2],data[3])
	if data[1] == "FINISH_SETUP" then
		local config = {data[2]}
		print("Finishing up, This might take a moment.")
		local success, err = pcall(function()
			ConfigStore:SetAsync("CONFIG",config)
		end)
		if success then
			print("Yay! lumeyIN has completed setup.")
    		for _,v in pairs(game.Players:GetChildren()) do --Gets a table of all players and goes through it.
      		  v:Kick() --Kicks the player.
  			  end
			
		end
	end
end)

I made it spit out one print at one point but removed it for some reason.

This code doesn’t look secure at all. Why are you sending data over from the client?

2 Likes

The code getting sent doesn’t need to be secure, the data in it wont really be able to be changed.
To answer why I’m sending from the client, this is a setup UI so I don’t really know a way to send data from a local gui to the server without doing this :wink:

Could you please go and re-test your code, then come back with the error that the code is experiencing instead of leaving us with “it errors but I don’t know what the message is”? You should also apply basic debugging to your script. “Moving stuff around” is not sufficient enough to magically make your code work and dumping your assets into a thread asking for fixes is misuse of this category.

I don’t know why this is happening, I don’t know how to make actual errors from prints and it doesn’t have any roblox made errors. I simply don’t know why anything exists.

You can know if you go back and do basic debugging on your code. The Scripting Support category isn’t a venue for free fixes, you need to put in the effort yourself as well.

Part of the problem is that you’re discarding the point of pcalls. Pcall, or protected call mode, is used to make calls and catch errors so you can do custom error handling. Errors you get in code don’t explicitly get sent to the console, so you need to do that yourself. You are currently ignoring the error mesasge that gets returned if a pcall fails.

1 Like