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
function onclick()
local PointsStore = DataStore2("Points", Player)
PointsStore:Increment(1)
end
script.Parent.MouseButton1Click:connect(onclick)
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.