I am making a game, where if the player uses an arrow, they will get a stand, which is nothing too important at the moment, and if the player uses an item called a rokaka, their stand will be deleted. My problem is that you can have multiple stands at the same time if you use an arrow without a rokaka. I tried to add something in my script that checks if they have a folder, with an object called StandSummon, and if they do, it should just print “hasStand”, and kill the player, which it does, but it also gives the player another stand, which I don’t want. It has an else statement for if there is no folder with StandSummon, which will give it the stand. It for some reason after finishing the if statement check for if they have a folder with the StandSummon object, it still gives a stand even if they already have a folder of that sort. This is not the entire script. Just a part of it.
for i, v in pairs(Backpack:GetChildren()) do
if v:IsA("Folder") then
local StandSummon = v:FindFirstChild("StandSummon")
if StandSummon then
print("has stand")
player.Character.Humanoid:TakeDamage(10000000000)
elseif v:FindFirstChild("StandSummon") == nil then
local Stand = Stands:FindFirstChild("Stand1"):Clone()
Stand.Parent = Backpack
local PlrStats = player:FindFirstChild("PlrStats")
if PlrStats then
local currentStand = PlrStats:FindFirstChild("Stand")
currentStand.Value = "Stand1"
end
end
end
end ```