Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Make a player limited to 1 of each tool?

Hi :), I made an tool giver, but I want that the player only has one of each tool (in this case a knife). I tried multiple things, but never worked. Someone that can help me?

this is the script of the tool giver with clickdetector

function hi(x)
	local y = x.Backpack
	local z = game.Lighting["Knife"]
	z:Clone().Parent = y
end

script.Parent.ClickDetector.MouseClick:connect(hi)

1 answer

✓ Accepted answer
function hi(x)
	local y = x.Backpack
	if y:FindFirstChild("Knife") or x.Character:FindFirstChild("Knife") then return end
	local z = game.Lighting["Knife"]
	z:Clone().Parent = y
end

script.Parent.ClickDetector.MouseClick:connect(hi)

7 comments

0

Ty, but now it dont give me the knife anymore.

1

i edited my answer, check if it works now! :)

0

very uncool mate

0

It worked!!! TY SO MUCH

0

shame on you for misspelling variables

0

who uses X and Y was variables :(

0

I copied a script with those variables because I was struggling to make my own

This discussion is preserved as it was. New answers, comments, and votes are closed.