Hello all community, I need your help what error I have in this script …
I have tried to do an AutoSave of statistics and material (physical, Objects), and I have the script in “ServerScriptService”, and it doesn’t work,
Who could help me?
Hello all community, I need your help what error I have in this script …
I have tried to do an AutoSave of statistics and material (physical, Objects), and I have the script in “ServerScriptService”, and it doesn’t work,
Who could help me?
local save_interval = 12
function SaveFunction(PLR)
coroutine.resume(coroutine.create(function()
while true do
wait(save_interval)
end)
end
Call the function by doing SaveFunction(Player)
The end in the last line remove the ) and the while true do end add a )
I said in line 8 write end) instead of end.
Ok my bad.
local save_interval = 12
local function SaveFunction(Player)
coroutine.resume(coroutine.create(function()
while true do
wait(save_interval)
end
end)
end
writing on my phone so
local save_interval = 12
local function SaveFunction(Player)
coroutine.wrap(function()
while true do
wait(save_interval)
-- code here
end
end)()
end
I misspelled “coroutine” replace it with that
You have your script stored in ServerStorage. Only module scripts can run in ServerStorage (when they’re called)
Store it in ServerScriptService
I already had it in the East.

Oh, there’s your issue. You’re using a LocalScript. ServerScriptService is Server Only, LocalScripts won’t run there. Put it in ReplicatedFirst
Also, LocalScripts can’t access ServerStorage, so if you’re using a module script for the save interval, put that in ReplicatedStorage
Also-Also, LocalScripts can’t edit values in leaderstats for the player, only the server can do that.
I recommend using remote events for the client and server to interact with
-- example
-- (localscript)
local remote = game:GetService("ReplicatedStorage").RemoteEvent
remote:FireServer() -- send a request to the server
-- (serverscript)
local remote = game:GetService("ReplicatedStorage").RemoteEvent
remote.OnServerEvent:Connect(function(player) -- the player who fired the remote is passed automatically
local level = -- directory to player's level here
level.Value += 1 -- adds 1 new level
end)
(SERVER SCRIPTS) – Is a Script normal?
Yes, server scripts are just normal scripts
I don’t want to bother you, I made a mistake in these signs

Oh I would have to put 0?
In Line 5