PlayerData SOMETIMES clone

So in my game, when a player joins he has a folder that is copied inside of him,

problem is that it SOMETIMES clone and SOMETIMES dosen’t

when it doesn’t clone the output says:
“Infinite yield possible on Players.Speezy:WaitForChild(“PlayerData”)”

and also says:
“Not running script because past shutdown deadline (x9)”

I’ve been stuck at this for many weeks and it is slowing down my work a lot

Ive looked everywhere, yt, devforum, scriptinghelpers

This error has started to happen recently, in my other games i use a lot of similar scripts and theres no error there so idk what im doing wrong

Please help!

I can’t help you unless you provide your code.

local DataStore2 = require(1936396537)

DataStore2.Combine(“MasterKey”, “Cash”)
local DefaultCash = 50

game:GetService(“Players”).PlayerAdded:Connect(function(plr)

local Stats = script.PlayerData:Clone()
print("Cloned")
Stats.Parent = plr
print("yes1")
local Cash = DataStore2("Cash", plr)

print("yes2")

local function UpdateCash(cash)
	plr.PlayerData.Cash.Value = cash
end

print("yes3")

UpdateCash(Cash:Get(DefaultCash))

print("yes4")

end)

it dosent even print anything, studio just dosent wanna run the line game:GetService(“Players”).PlayerAdded:Connect(function(plr)

Have you tried testing it in an actual game? PlayerAdded sometimes doesn’t work if the player is loaded in before a connection to PlayerAdded is made. I’ve had this problem recently as well, and my script worked fine in-game.

okay let me try
although every time i wanna test something will i have to always publish and then try it out in a real server?

ill test it 10 times and ill see if it works on all of my attempts

as kampfkarren said do not require the id but get the latest module of the datastore2 and require that module

also enable api services and publish the game

okay ill also try that thanks 30 chars

so far ive tested it 4 times it worked on all of them

Did you test it in-game or in-studio?

Were there any other errors and did all of the prints run?

yep i can confirm it works in game

Alrighty, I’m glad I could help :+1:

yeah wait

if i wanna add something to my game, do i always have to publish it and to try it in game,

that would be pretty slow imo

okay thanks it seems to work but now theres still the error
“Not running script because past shutdown deadline (x9)”

studio crashes for like 20 seconds and then i can freely use studio again

oh no

From read on another topic where the same issue was being discussed, you can do something like this

okay ill give it a read thanks

so ive done what he said and it dosent work,

“attempt to call a Instance value”