I know that there a way to make it so if a player has a certain tool in their inventory, they can click on a "Part" that has a click detector on it with the key, which is the tool that I referenced above, in their Inventory.
What I am basically wanting to achieve is the player must find a key, pick it up, then bring it to said "Part" and click on it to unlock it, which in this case would be to run the event :Destroy(). Then this will allow the player to freely open and close the door.
I am fairly new to scripting and love figuring things out myself. I would just like to be pointed in a certain direction on how to do this since I am just now beginning with making tools and wanting to make something like this.
Thanks :)
local Door = game.Workspace:WaitForChild("Door") local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.Button1Down:Connect( function() local Target = Mouse.Target if Target == Door then for i, v in pairs(game.Players:GetPlayers()) do local character = v.Character character.ChildAdded:Connect( function(tool) if tool:IsA("Tool") then if tool.Name == "Tool" then Door:Destroy() end end end ) end end end )