I’m trying to create a simple GUI that adds one point per click to the player’s stats. However, the LocalScript isn’t able to require() from ServerScriptService because it’s client-side only. Also, is it even possible to require() DataStore2 from a LocalScript? I’ve never worked with DataStore2 before so this is all new ground to me.
local DataStore2 = require(game.ServerScriptService.StatsDataStore2:WaitForChild("MainModule"))
local Player = game.Players.LocalPlayer
local PointsStore = DataStore2("Points", Player)
The client can’t access ServerScriptService, so it’s better to put client sided modules in ReplicatedStorage.
And DataStore2 should be used on the server, not the client.
You cannot require module scripts locally which are in areas that the local player cannot access. Try using ReplicatedStorage instead.
Don’t know anything about DataStore2 but I’d assume you can’t use it locally anyway.
you cant give points from the client with or without DataStore2 because in the server it will remain as unchanged and i suggest you to use events to give stats.If u use clients for DataStore2 hackers can change their stats easily and save them too.