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

Ugh, my script isn't working and i dont know why can anyone help?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So, my script says model does not exist in the output when i run it, which is weird, because it says it in the script, can anyone help? Here's the script to look at, if needed:

game.Players.PlayerAdded:connect(function(NPlayer)
    local NewLibrarySave = Instance.new("Model", NPlayer)
NewLibrarySave.Name = "LibraryStuff"
local NewItemsInLibrary = Instance.new("NumberValue", NewLibrarySave)
NewItemsInLibrary.Name = "ItemsInLibrarySave"
 NPlayer:WaitForDataReady()
NPlayer:LoadString("NumberOfItemsInLibrary")
for i = 1, NewLibrarySave.Value do
NPlayer:LoadString("LibraryStuff" .. i)
end
end)
game.Players.PlayerRemoving:connect(function(OPlayer)
local OPlayerLibraryStuff = {}
for i,v in pairs(OPlayer.LibraryStuff:GetChildren()) do
table.insert(OPlayerLibraryStuff, v)
end
for i = 1, #OPlayerLibraryStuff do
if OPlayer.LibraryStuff:FindFirstChild("Library Item #" .. i) then
local x = OPlayer.LibraryStuff:FindFirstChild("Library Item #" .. i)
OPlayer:SaveData("LibraryStuff" .. i, x)    
end 
end
end)

Answer this question