Inventory system save slots

Is not erros I mean inside the gui event for fire the remote function I dont know how I can make it working.

like I can put everything I need to fire after in line48?

Type:

game.ReplicatedStorage.ShopEvent:FireServer("toolname") -- tool name

In replicated storage add an remote event and name it ShopEvent, then add a server side script in server script service,

There add a function:

game.ReplicatedStorage.ShopEvent.OnServerEvent:Connect(function(plr,toolname)
  local clone = game.ReplicatedStorage:FindFirstChild(toolname):Clone()
  clone.Parent = plr.StarterPack
end)
1 Like

"StarterPack is not a valid member of Player “Players.ToxicalGamer2006"”

1 Like

Cool, maybe they changed it to StarterGear from StarterPack

its plr.Backpack not plr.StarterPack

1 Like

How about starter pack? they removed it? how do you think the tool will respawn after player dies

There is nothing like starterpack in the local player tho

image

1 Like

What do you think, this reply is xd

1 Like

so I have to use StarterGear? and not StarterPack?

1 Like

Yes, use startergear not pack i told it wrong word sorry for that

but startergear doesnt clone after death?

Check it, so you can verify by yourself and I may be wrong because I have worst memory

Nvm it clone xd sorry for that thank you soo much. (thank you too South)

1 Like

it should be Backpack and then do a script that saves the backpack children?

Don’t you think your making it too complicated for an normal scripter xd

1 Like

Sorry for the delay but I forget to say the inv limit doesnt work. And I was trying to do something like that more basic.

Do this from server side script, and change the game.Players.LocalPlayer to player using a remote event, you cannot clone,destroy tools using a local script

I’m not very familiar with RemoteEvents but I will try to do that.

Ok I dont have any idea how I can make it. I cant just put that inside the GUI function or something more simple.?

I did this:

limit = 0


equip.MouseButton1Click:Connect(function()
	if selected == "classic" then
		if tool1Equipped == false then
			tool1Equipped = true
			tool1:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.ClassicSwordEvent:FireServer("ClassicSword")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		elseif limit >= 1 then
			tool1Equipped = true
			equip.Text = "test"
		else
			tool1Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("ClassicSword"):Destroy()
			player.StarterGear:FindFirstChild("ClassicSword"):Destroy()
		end
	end
end)

I used 2 button and 3 button just for test (2 button gives -1 and 3 button gives +1

it worked but you can see I can equip before it shows “test” (basicly full inv)

full script:

local player = game.Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local leaderstats = player:WaitForChild("toolLeaderstats")
local toolsRS = RS.Tools
local scrollFrameMelee = script.Parent.Parent.Meeles
local scrollFrameGuns = script.Parent.Parent.Guns

--------Tool Buttons ------
local classic = scrollFrameMelee.ClassicSwordButton
local classicBomb = scrollFrameMelee.ClassicBombButton
local Bagguete = scrollFrameMelee.BaggueteSwordButton
local BanH = scrollFrameMelee.BanHammerButton
local StopSign = scrollFrameMelee.StopSignButton
local Bat = scrollFrameMelee.BatButton
local LondonKnife = scrollFrameMelee.LondonKnifeButton
local FryingPan = scrollFrameMelee.FryingPanButton

local equip = script.Parent.ToolButton
local ToolNameText = script.Parent.ToolName
local ToolDescp = script.Parent.ToolDescription
local ToolImage = script.Parent.ToolImage
local selected = nil
-------- var for equip-----
local tool1Equipped = false
local tool2Equipped = false
local tool3Equipped = false
local tool4Equipped = false
local tool5Equipped = false
local tool6Equipped = false
local tool7Equipped = false
local tool8Equipped = false
---------RS tools-----------
local tool1 = toolsRS.ClassicSword
local tool2 = toolsRS.ClassicBomb
local tool3 = toolsRS.BaggueteSword
local tool4 = toolsRS.BanHammer
local tool5 = toolsRS.StopSign
local tool6 = toolsRS.Bat
local tool7 = toolsRS.LondonKnife
local tool8 = toolsRS.FryingPan
---------------------------
-- Equip button---
limit = 0


equip.MouseButton1Click:Connect(function()
	if selected == "classic" then
		if tool1Equipped == false then
			tool1Equipped = true
			tool1:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.ClassicSwordEvent:FireServer("ClassicSword")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		elseif limit >= 1 then
			tool1Equipped = true
			equip.Text = "test"
		else
			tool1Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("ClassicSword"):Destroy()
			player.StarterGear:FindFirstChild("ClassicSword"):Destroy()
		end
	end
end)


equip.MouseButton1Click:Connect(function()
	if selected == "classicBomb" then
		if tool2Equipped == false then
			tool2Equipped = true
			limit = limit - 1
			print(limit)
			tool2:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.ClassicBombEvent:FireServer("ClassicBomb")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool2Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("ClassicBomb"):Destroy()
			player.StarterGear:FindFirstChild("ClassicBomb"):Destroy()
		end
	end
end)

equip.MouseButton1Click:Connect(function()
	if selected == "Bagguete" then
		if tool3Equipped == false then
			tool3Equipped = true
			limit = limit + 1
			print(limit)
			tool3:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.BaggueteSwordEvent:FireServer("BaggueteSword")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool3Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("BaggueteSword"):Destroy()
			player.StarterGear:FindFirstChild("BaggueteSword"):Destroy()
		end
	end
end)

equip.MouseButton1Click:Connect(function()
	if selected == "BanH" then
		if tool4Equipped == false then
			tool4Equipped = true
			limit = limit + 1
			print(limit)
			tool4:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.BanHammerEvent:FireServer("BanHammer")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool4Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("BanHammer"):Destroy()
			player.StarterGear:FindFirstChild("BanHammer"):Destroy()
		end
	end
end)

equip.MouseButton1Click:Connect(function()
	if selected == "StopSign" then
		if tool5Equipped == false then
			tool5Equipped = true
			tool5:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.StopSignEvent:FireServer("StopSign")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool5Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("StopSign"):Destroy()
			player.StarterGear:FindFirstChild("StopSign"):Destroy()
		end
	end
end)

equip.MouseButton1Click:Connect(function()
	if selected == "Bat" then
		if tool6Equipped == false then
			tool6Equipped = true
			tool6:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.BatEvent:FireServer("Bat")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool6Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("Bat"):Destroy()
			player.StarterGear:FindFirstChild("Bat"):Destroy()
		end
	end
end)

equip.MouseButton1Click:Connect(function()
	if selected == "LondonKnife" then
		if tool7Equipped == false then
			tool7Equipped = true
			tool7:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.LondonKnifeEvent:FireServer("LondonKnife")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool7Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("LondonKnife"):Destroy()
			player.StarterGear:FindFirstChild("LondonKnife"):Destroy()
		end
	end
end)

equip.MouseButton1Click:Connect(function()
	if selected == "FryingPan" then
		if tool8Equipped == false then
			tool8Equipped = true
			tool8:Clone().Parent = player.Backpack
			RS.ToolsCloneRemoteEvents.FryingPanEvent:FireServer("FryingPan")
			equip.Text = "Unequip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		else
			tool8Equipped = false
			equip.Text = "Equip weapon" 
			equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
			player.Backpack:FindFirstChild("FryingPan"):Destroy()
			player.StarterGear:FindFirstChild("FryingPan"):Destroy()
		end
	end
end)
-- Change Buttons --

classic.MouseButton1Click:Connect(function()
	selected = "classic"
	if tool1Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool1.Name
		ToolDescp.Text = "Description: Classic Roblox sword"
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool1.Name
		ToolDescp.Text = "Description: Classic Roblox sword"
	end
end)

classicBomb.MouseButton1Click:Connect(function()
	selected = "classicBomb"
	if tool2Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool2.Name
		ToolDescp.Text = "Description: Roblox ClassicBomb"
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool2.Name
		ToolDescp.Text = "Description: Roblox ClassicBomb"
	end
end)

Bagguete.MouseButton1Click:Connect(function()
	selected = "Bagguete"
	if tool3Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool3.Name
		ToolDescp.Text = "Description: OUI OUI BAGGUETE"
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool3.Name
		ToolDescp.Text = "Description: OUI OUI BAGGUETE"
	end
end)

BanH.MouseButton1Click:Connect(function()
	selected = "BanH"
	if tool4Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool4.Name
		ToolDescp.Text = "Description: Get banned xd"
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool4.Name
		ToolDescp.Text = "Description: Get banned xd"
	end
end)

StopSign.MouseButton1Click:Connect(function()
	selected = "StopSign"
	if tool5Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool5.Name
		ToolDescp.Text = "Description: S T O P"
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool5.Name
		ToolDescp.Text = "Description: S T O P"
	end
end)

Bat.MouseButton1Click:Connect(function()
	selected = "Bat"
	if tool6Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool6.Name
		ToolDescp.Text = "Description: BONK!"
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool6.Name
		ToolDescp.Text = "Description: BONK!"
	end
end)

LondonKnife.MouseButton1Click:Connect(function()
	selected = "LondonKnife"
	if tool7Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool7.Name
		ToolDescp.Text = "Description: London."
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool7.Name
		ToolDescp.Text = "Description: London."
	end
end)

FryingPan.MouseButton1Click:Connect(function()
	selected = "FryingPan"
	if tool8Equipped == false then
		equip.Text = "Equip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
		ToolNameText.Text = "Tool: "..tool8.Name
		ToolDescp.Text = "Description: Cool for make eggs and bacon."
	else
		equip.Text = "Unequip weapon" 
		equip.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
		ToolNameText.Text = "Tool: "..tool8.Name
		ToolDescp.Text = "Description: Cool for make eggs and bacon."
	end
end)