sometimes the deaths leaderboard appears and sometimes it isnt there, why does this happen?
01 | local dss = game:GetService( "DataStoreService" ) |
02 |
03 | local deathsDataStore = dss:GetDataStore( "deathsDataStore" ) |
04 |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 |
07 | local leaderstats = player:WaitForChild( "leaderstats" ) |
08 |
09 | local deaths = Instance.new( "IntValue" ) |
10 | deaths.Name = "Deaths" |
11 | deaths.Parent = leaderstats |
12 |
13 | local data |
14 | local success, errormsg = pcall ( function () |
15 | data = deathsDataStore:GetAsync(player.UserId.. "-deaths" ) |
you have to call the function by usnig WaitForChild
local part = script.Parent.WaitForChild(Connect:function[player])
print("NameOfChild").ReplicatedStorage = Vector3.new("Really red") end)
functionofWaitForChild()