I’m trying to make it so a player can obtain ONLY one tool at a time and not multiple, how can I do that?
Check if there is already an existing tool inside their backpack and character model, if it does, destroy that tool and replace it with the next tool.
1 Like
Okay, I’ll try that, I’ll update you if it works.(I’ve tried that before, but I failed a couple times with it.)
This is just a basic way to disable multiple giving.
local Part = script.Parent
local Tool = script.Parent.Tool
Part.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChildOfClass("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(Tool)
if Hit.Parent:FindFirstChild(Tool) or Player.Backpack:FindFirstChild(Tool) then
return end
else
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
Tool:Clone().Parent = Player.Backpack -- Hit.Parent instead of Player.Backpack to Equip automatically.
end
end
end)
2 Likes
Making custom backpack is the best for this issues i think
1 Like
I think I remember making a script something like that a while back, not sure where it is, but I’ll try this out!
Instead of return end you can do if not Hit.Parent:FindFirstChild(Tool) or Player.Backpack:FindFirstChild(Tool) then
ps and then the last bit inside of the else statement