Hey! So, I've made a limited amount of items you can have in your inventory (2). My problem is, when you reset, you don't have any more tools- meaning you'll be able to get another one. For some reason, resetting and trying to get another doesn't work.

(basically, i can't get any other tool after you reset, even though i have less than 2)

I've done my research and asked a few people, but they couldn't seem to help. I ended up putting this local script in StarterCharacterScripts, thinking that when you reset, it'd solve the problem. Though, it hadn't. Here's my script:

--//variables//
local Player = game.Players.LocalPlayer
local tools = Player.Backpack:GetChildren()
--//detecting Violin
if Player.Backpack:FindFirstChild("eViolin") then
	if #tools == 2 then
		local violin = game.ReplicatedStorage.eViolin:Clone()
		violin.Parent = Player.Backpack
		violin:Destroy()
	else
		local violin = game.ReplicatedStorage.eViolin:Clone()
		violin.Parent = Player.Backpack
	end
end

Any help is appriciated!! If you do decide to help, I ask that you stay active on the post because it may not work or I may have questions.

Also note, this is the WHOLE script that I'm having trouble with. I have another script with how to obtain the tool in a completely different area which had worked perfectly fine and most likely has nothing to do with this :)

2 comments

0

why did u make a clone on line 9 just to destroy it?

0

@kk to get the violin in backpack to destroy if there were already 2 tools. For the most part it works fine.