Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

my tool saving script is not working. why?

Im trying to make a script that can save the tools that players gained during their journey i made this so far but is not working


local key = "keyg3n"

local players = game:GetService("Players")

game.Players.PlayerAdded:connect(function(loady)

local player = players:GetPlayerFromCharacter(loady)

local backpack = player.BackPack

loady:WaitForDataReady()

tools = loady:loadInstance(key..player.Name)

tools.Parent = backpack

end)

game.Players.PlayerRemoving:connect(function(savy)

local player = players:GetPlayerFromCharacter(savy)

local backpack = player.BackPack

local inventory = backpack:GetChildren()

savy:WaitForDataReady()

if inventory then

	savy:saveInstance(key..player.Name)

end

end)


what is wrong on my script?

it is supposed to keep the tools that players gained whem they leave or die

NOTE: its my first time asking a question so im sorry for any mistake above

1 answer

Maybe the mistake is that you wrote 'BackPack' instead of 'Backpack'. Also, for these lines

game.Players.PlayerAdded:connect(function(loady)
game.Players.PlayerLeaving:connect(function(savy)

You would replace game.Players with players.

2 comments

0

there are no lines saying played added etc

0

ive replaced BackPack with Backpack but still nothing

This discussion is preserved as it was. New answers, comments, and votes are closed.