I want to detect if player has bloxy cola in their inventory. I used this:
if player.Backpack:FindFirstChild("BloxyCola") == nil and character:FindFirstChild("BloxyCola") == nil then
local clone = tool1:Clone()
clone.Parent = player.Backpack
end
The weird part is that this script works perfectly fine in another script I have, but in this script it gets exhausted trying to find the bloxy cola for some reason.
Is only dont put the “== nil” to “if not player.Backpack (…)” and the next things
And to put the tool allways, is only put the tool to player.Backpack and player.StarterGear to never disappear (or put the tool on game.StarterPack in the studio)
if not player.Backpack:FindFirstChild("BloxyCola") and not character:FindFirstChild("BloxyCola") then
local clone = tool1:Clone()
clone.Parent = player.Backpack
end
After he have the item, if he dies or reset, the item disappear, to this dont happend you can make
if not player.Backpack:FindFirstChild("BloxyCola") and not character:FindFirstChild("BloxyCola") then
local clone = tool1:Clone()
clone.Parent = player.Backpack
local clone = tool1:Clone()
clone.Parent = player.StarterGear
end
Update: Well turns out we still have a problem. So basically the script still gets exhausted sometimes but the script still works for some reason after it gets exhausted.
I did, and it just waits that amount of time and then it freezes the game for a little bit then returns an error saying it got exhausted but the script still works anyways.