RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"let a npc that the script is in able to use a item by a id and make it use the tool by clicking"
-- server script local NPC = script.Parent local Tool = game:GetService("ServerStorage"):FindFirstChild("ToolName") -- Replace "ToolName" with the name of your tool -- Function to equip and use the tool local function useTool() local clonedTool = Tool:Clone() clonedTool.Parent = NPC NPC.Humanoid:EquipTool(clonedTool) wait(1) -- wait for 1 second NPC.Humanoid:UnequipTools() end -- Function to respond to click local function onClick() useTool() end -- Connect the function to the click event NPC.ClickDetector.MouseClick:Connect(onClick)