#Changing local scripts to server scripts? suphi data store

1 messages · Page 1 of 1 (latest)

dusky stirrup
#

Hello Guys, I have followed this video https://www.youtube.com/watch?v=UAdE8-AfuMo
it is very understandble but I am still new to lua ( a few days only :/ )
I am finding it hard to save the leaderstats attributes,
I have seen the whole video but suphi shows only a server side way,
I have a meditation script

I am sorry for my terrible english, I am still studying 🙂

    while Meditate == true do 
        player.EXP.Value = (player.EXP.Value) + (player.Level.Value*5) + (player.Age.Value)
        
        if player.EXP.Value >= player.TNL.Value then
            player.Level.Value = player.Level.Value + 1
            player.EXP.Value = player.EXP.Value - player.TNL.Value
            player.TNL.Value = player.TNL.Value * 1.3
        end
        --Saving
        remote:FireServer(player.EXP.Value, player.Level.Value, player.TNL.Value)
        task.wait(5)
    end
end```


this is from my original datastore, 
it works simply by going local play - leader stats - attributes - values..
and every 5 sec it fires a remote to server which saves the attributes.. :/ 
I want to make it much much smarter using suphi scripts..
yet I am finding it hard to implant and save 

I also made the meditate tick every 5s cause I dont want 
sending remotes every 1s

this is what I did - 

```local DataStoreModule = require(game.ServerStorage.DataStore)
local dataStore = DataStoreModule.find("Player", player.UserId)


local function GainQi()
    while Meditate == true do 
        --simple testing?
        dataStore.Value.EXP += 1
        dataStore.Leaderstats.EXP.Value = dataStore.Value.EXP
        -- save??
        remote:FireServer(player.EXP.Value, player.Level.Value, player.TNL.Value)
        task.wait(5)
    end
end```
#

is it even possible to run my local scripts in SSS??
at first I was sure suphi leaderstats script
actually checks for each value change and saves them automaticlly.. :/

    if state ~= true then return end
    for index, name in keys do 
        dataStore.LeaderStats[name].Value = dataStore.Value[name]
    end
end```
coarse cipher
#

local scripts can not run in the server script service