So, I got a "small" problem. I can't make if a player step on a block, the tool from the player backpack will destroyed. The "Tool" and the "Area" is located in Workspace, with scripts. The "Tool" is located in Workspace.Tools The "Area" is located in Workspace.Job
I added a script to "Area", and two scripts to the "Tool".
I tried to make some scripts. Here is the script, what I added to the "Area"
Toolname = "TestBox01"
function touch(Player)
if not Player.Inventory:FindFirstChild("TestBox01") then
local Box = game.Workspace.Tools.TestBox01:Destroy()
Box.Parent = Player.Backpack
end
end
script.Parent.Touched:Connect(touch)
And here is the Tool script.
--PickUpScript
Toolname = "TestBox01"
function touch(Player)
if not Player.Backpack:FindFirstChild("TestBox01") then
local Box = game.Workspace.Tools.TestBox01:Clone()
Box.Parent = Player.Backpack
end
end
script.Parent.ClickDetector.MouseClick:Connect(touch)
And another one script in "Tool"
tool = script.Parent
handle = tool:WaitForChild("Handle")
tool.Equipped:Connect(function()
print("The tool was equipped!")
end)

1 comment
You should look in the Output window, you can find it in the View menu. Things like Player.Inventory don't exist as far as I'm aware. I think you're looking for Player.Backpack. Additionally if a part touches something, that other part is generally a part of the character, not the player. Once again the Output should tell most of those things to you.