how to give a player 1 point after every 60 seconds.
local DataStore2 = require(1936396537) local defaultValue = 0 game.Players.PlayerAdded:Connect(function(plr) local pointsDataStore = DataStore2("points",plr) local leaderstats = Instance.new("Folder",plr) leaderstats.Name = "leaderstats" local points = Instance.new("IntValue",leaderstats) points.Name = "Points" local function pointsUpdate(updatedValue) points.Value = pointsDataStore:Get(updatedValue) end pointsUpdate(defaultValue) pointsDataStore:OnUpdate(pointsUpdate) end) while true do wait(60) local pointsDataStore = DataStore2("points",player) pointsDataStore:Increment(1,defaultValue) end)
while(wait(60)) do points = points + 1 end
Change "points" to whatever variable or instance that's storing points for whatever player you're looking for. You could put this in a script and parent that script to a specific player and find the points value based on that parent player.
Your script has some minor issues like some typos Make sure these are in the serverscriptservice:
Leaderboard script:
game.Players.PlayerAdded:Connect(function(plr) local stats = Instance.new("Folder",plr) stats.Name = "leaderstats" local money = Instance.new("IntValue",stats) money.Name = "Money" money.Value = 0 while wait(3) do -- change this to whatever time you want money.Value = money.Value + 60 end end)
Datastore script:
local DATA_STORE_NAME = "Config" local DATA_STORE_SCOPE = "MyGameName" local KEY_NEW_FEATURE = "NewFeatureEnabled" local DataStoreService = game:GetService("DataStoreService") local dsConfig = DataStoreService:GetDataStore(DATA_STORE_NAME, DATA_STORE_SCOPE) local function checkFeature() local isFeatureEnabled local success, err = pcall(function() isFeatureEnabled = dsConfig:GetAsync(KEY_NEW_FEATURE) end) if success then print(KEY_NEW_FEATURE .. ": " .. tostring(isFeatureEnabled)) if isFeatureEnabled == true then print("Feature is enabled!") elseif isFeatureEnabled == false then print("Feature is disabled!") elseif isFeatureEnabled == nil then print("Feature is not set!") else -- Some other value was found in this key end else print("Failed to load feature! Error: " .. tostring(err)) end return success end local function onFeatureChanged(isFeatureEnabled) print("Feature toggled: " .. tostring(isFeatureEnabled)) end -- Listen for changes dsConfig:OnUpdate(KEY_NEW_FEATURE, onFeatureChanged) local function setFeatureEnabled(isFeatureEnabled) local success, err = pcall(function() dsConfig:SetAsync(KEY_NEW_FEATURE, isFeatureEnabled) end) return success end setFeatureEnabled(true) checkFeature()
lua while true do player.leaderstats.Points.Value = game.Players.braydonboiii.leaderstats.Points.Value + 1 wait(60)