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

Pets disappear from players inventory when player dies?

Asked by 4 years ago
Edited 4 years ago

Hello. Ive made a pet system, everything works well until the player dies. All of the pets the player had in their inventory disappear from their inventory with no errors. Does anybody know how I can fix this?

01local function addToFrame(pet)
02 
03 
04    local newTemplate = Template:Clone()
05    newTemplate.Name = pet.Name
06    newTemplate.PetName.Text = pet.Name
07    newTemplate.Parent = scrollframe
08 
09    local NewPet = pet:Clone()
10    NewPet.Parent = newTemplate.PetImage
11 
12    local camera = Instance.new("Camera")
13    camera.CFrame = CFrame.new(NewPet.PrimaryPart.Position + (NewPet.PrimaryPart.CFrame.LookVector * 3),NewPet.PrimaryPart.Position)
14    camera.Parent = newTemplate.PetImage
15 
View all 46 lines...

2 answers

Log in to vote
0
Answered by 4 years ago

go the the screengui and set "ResetOnSpawn" to false

0
Thank you so much! I've been struggling with this problem for ages, and I just realised I could do that. mrdoghuman_yt 2 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Try to store the pets in a player folder created by a script (Example game.Players.LocalPlayer.PetStorage.PET) and if the player leaves the game, you will need to use datastores

Answer this question