What would I write for a LocalScript for when the player respawns? I have this problem where if the players are in the middle of putting on clothing or consuming an item and they die, whenever they respawned, their inventories would be gone. That’s because I added some code to disable and reenable the player’s inventory. If the player dies, that code in the script doesn’t exist anymore and it doesn’t work, leaving the players with no inventory.
You can do soemthing like this:
Add a localscript in starterplayerscripts:
Put this code inside:
local plr = game.Players.Localplayer
local StartGUI = game:GetService("StarterGui")
plr.CharacterAdded:Connect(function()
StartGUI:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end)
1 Like
Spelling error for “LocalPlayer”, but I fixed it and it works. Thanks
I just wrote that in forums IDE, and it doesn’t have autocorrect sooo
Yeah. Good thing it helped you though!