I need help with changing this code so it raises 1 point every 15 seconds from when the player joins, not every 15 seconds the server is active and to make it so people in a certain group with a certain role will get a point raise, not guests:
amount = 1 timedelay = 15 currencyname = "Points" while true do wait(timedelay) for i,v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("leaderstats") and v then v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount end end end
LocalScript inside the PLAYER OBJECT
local remoteEvent = "PATH_TO_YOUR_REMOTE" while true do wait(15) remoteEvent:Fire() end
A script in ServerScriptService
local remoteEvent = "SAME_PATH_AS_LAST_ONE" remoteEvent.OnServerEvent:Connect(function(player) player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1 end)
One issue with this is that it's veeeeeeeeeery exploitable. All an exploiter has to do is fire the remote to get +1 point, they could put this in a loop etc but you could check how often it's being fired from the client with tick() i think xd
This is just the leaderstat script, it might not work though, it is for a rough of what it can be like:
local Lplayer = game.Players.Localplayer -- Find Local player local LplayerLeaderstat = game.Lplayer.Leaderstat -- Get local leaderstat while true do -- Loop every 15 seconds wait(15) LplayerLeaderstat.Points.Value = LplayerLeaderstat.Points.Value + 1 -- +1 point end