Good day
I need help with the item giver script with a limit (if the player does not have more than 2 items, he will give the item.)
otherwise it will give him nothing.
Here’s what I’ve created so far:
script.Parent.ProximityPrompt.Triggered:Connect(function(player) print(player)
----
for i, Tool in pairs(player.Backpack:GetChildren()) do print(Tool) print(i)
------
if not i > 3 then print("cangive")
-------
local item = game.ServerStorage.Tool1:Clone() print("clone")
item.Parent = player.Backpack print("parentback")
-----
else
print("else")
end print("end")
end
end)
print("end3end")
Problem: Script detects only one tool (I tested it with two tools)
when print (Tool) writes me one of the tools and print (i) writes me 1
And then it writes the error: Workspace.Part.Script: 5: attempt to compare boolean <number
I can’t handle it, I searched for posts but I didn’t find anything
It should be added that if I did it the other way (if i <2 then) it will give me an item in any case
and if i <3 then give me two items.
I will be happy for any help