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!
1NSTAN_CE
(Force0h)
August 27, 2020, 4:24am
#2
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)
1NSTAN_CE
(Force0h)
August 27, 2020, 4:33am
#6
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
FerbZides
(FerbZides)
August 27, 2020, 4:35am
#9
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
1NSTAN_CE
(Force0h)
August 27, 2020, 4:36am
#12
Did you test it in-game or in-studio?
1NSTAN_CE
(Force0h)
August 27, 2020, 4:37am
#14
Were there any other errors and did all of the prints run?
yep i can confirm it works in game
1NSTAN_CE
(Force0h)
August 27, 2020, 4:38am
#17
Alrighty, I’m glad I could help
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
1NSTAN_CE
(Force0h)
August 27, 2020, 4:45am
#21
From read on another topic where the same issue was being discussed, you can do something like this
Yeah, phSalami is correct here. Studio won’t fire PlayerAdded immediately.
My rule of thumb here, which has also fundamentally changed how I structure my code, is that all your functions should be local variables and you do connections at the end of a script. This way, not only do you avoid issues in Studio, but you gain other benefits like neatness (?).
I will always write PlayerAdded code, regardless of what it’s for, in the following manner:
local function playerAdded(player)
end
Players.…
okay ill give it a read thanks
so ive done what he said and it dosent work,
“attempt to call a Instance value”