Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How fix this maybe outdated script that does not work anymore?

Asked by 4 years ago
Edited 4 years ago

I don't know what happened but the scrip stopped working, please help, and if you are wondering how I don't know to fix it, I am a starting coder.

local severStorage = game:GetService("ServerStorage")
local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
--------------Stats--------------
game.Players.PlayerAdded:Connect(function(player)
    --------------leaderstats and dataFolder--------------
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local dataFolder = Instance.new("Folder")
    dataFolder.Name = player.Name
    dataFolder.Parent = severStorage.RemoteData
    --------------DeathStats--------------
    local deaths = Instance.new("StringValue")
    deaths.Name = "Deaths"
    deaths.Value = DataStore:GetAsync(player.UserId).Deaths or "0"
    deaths.Parent = leaderstats

    player.CharacterAdded:Connect(function(char)
        local humanoid = char:FindFirstChild("Humanoid")
        humanoid.Died:Connect(function()
            wait(0.001)
            deaths.Value = deaths.Value + 1
        end)
    end)
    --------------TotalTimeStats--------------
    local TotalTime = Instance.new("StringValue")
    TotalTime.Name = "TotalTime"
    TotalTime.Parent = leaderstats
    TotalTime.Value = DataStore:GetAsync(player.UserId).TotalTime or "0"

    while true do 
        wait(1)
        TotalTime.Value = TotalTime.Value +1
    end
end)
0
is there any errors? tylergoatboy 82 — 4y
0
no ivan6361 34 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Are you getting any errors? try using print() functions to figure out how far through the script its getting before it fails. Also, make sure in studio on the home tab -> Game Settings -> Options -> Allow HTTP Requests and Enable Studio Access to API Services are both turned on :)

0
no errors ivan6361 34 — 4y
0
OMG THANK YOU ivan6361 34 — 4y
Ad

Answer this question