I have got a problem in my script where my function doesn’t run with the character added part. If you know a solution without removing the part, please say!
Also I’m on a phone so I can’t access studio right now but I will later.
SellInventoryBTN.MouseButton1Click:Connect(function()
player.CharacterAdded:Wait()
print("Sell Inventory CLicked")
local tool = player.Backpack:FindFirstChildWhichIsA("Tool")
local tools = player.Backpack:GetChildren()
RemoveSoldItem:FireServer(player, tool)
print(#tools)
for i, tool in pairs(tools) do
if TotalPrice ~=0 then
tool:Destroy()
else
for i, tool in ipairs(tools) do
tool:Destroy()
end
end
end
player.leaderstats.Credits.Value += TotalPrice
TotalPrice = 0
end)
In another script it needs to wait for the character to check if the tools in the player’s backpack is there or not.I don’t know why but when i remove it, it doesn’t check and gives me tools that weren’t in my inventory before I left the game.