I tried making a script if a player triggered a Prompt while holding a tool then give the npc the tool and if the npc didn’t chat that they ordered the Part, They Chat I didn’t order this then they jump out of the sit and walk to a part then another one and then they get destroyed, There’s a NPC spawner so there are many npcs need franklin walk 2 part so I may need help because the script is inside the tool in a local script, i also need so it can also chat whatever the chat text has and make it so it only chats one of them, i also need it so if i ask what do they what?, they chat one of the chat texts, Here’s the Script:
local plr = game.Players.LocalPlayer
local npc = game.Workspace["Franklin Walking From Part To Part"]
local Prompt = npc.ProximityPrompt
local tool = script.Parent
local walkto = game.Workspace.WAlKtoWAITERpart
Prompt.Enabled = true -- prompt not enableing
local Chat = game.Chat
local text = "I didnt order this"
-- You Can Add More If You Want
local function OnChatted()
print("Tool Gived")
tool.Parent = npc.Character
npc:EquipTool(tool)
plr.Backpack[tool]:Destroy()
end
tool.Equipped:Connect(function()
Prompt.Triggered:Connect(function()
if tool then
if Chat.Chatted == text then
OnChatted()
else
Chat:Chat(npc.Head, text, Enum.ChatColor.White)
npc.Humanoid.Jump = true
npc.Humanoid:MoveTo(walkto.Position)
wait(1000000000)
npc.Humanoid:MoveTo(workspace.Detroy.Position)
wait(3)
npc:Destory()
end
end
end)
end)
local Players = game:GetService("Players")
local ChatService = game:GetService("Chat")
local player = Players.LocalPlayer
local tool = script.Parent
local npcName = "Franklin Walking From Part To Part"
local npc = game.Workspace:FindFirstChild(npcName)
local prompt = npc and npc:FindFirstChildOfClass("ProximityPrompt")
local walkToPart = game.Workspace:FindFirstChild("WAlKtoWAITERpart")
local destroyPart = game.Workspace:FindFirstChild("Destroy")
if not (npc and prompt and walkToPart and destroyPart) then
warn("Ensure all required parts (NPC, ProximityPrompt, Walking part, Destroy part) are correctly named and available in the workspace.")
return
end
prompt.Enabled = true
local responses = {
"I didn't order this",
"Order Received",
}
local orderReceived = responses[2]
local notOrdered = responses[1]
local function chatWithNpc(npc, text)
ChatService:Chat(npc.Head, text, Enum.ChatColor.White)
end
local function onToolGiven()
tool.Parent = npc.Backpack
npc:EquipTool(tool)
player.Backpack:FindFirstChild(tool.Name):Destroy()
end
tool.Equipped:Connect(function()
prompt.Triggered:Connect(function(triggeringPlayer)
if triggeringPlayer == player and tool.Parent == player.Character then
if orderReceived == notOrdered then
onToolGiven()
else
chatWithNpc(npc, notOrdered)
npc.Humanoid.Jump = true
npc.Humanoid:MoveTo(walkToPart.Position)
npc.Humanoid.MoveToFinished:Wait()
wait(1)
npc.Humanoid:MoveTo(destroyPart.Position)
npc.Humanoid.MoveToFinished:Wait()
wait(1)
npc:Destroy()
end
end
end)
end)
tool.Activated:Connect(function()
prompt.Enabled = true
chatWithNpc(npc, "What do you want?")
end)
First, I didn’t see the part where if npc chatted they wanted the Part then they chat thanks and if not then chat I didn’t order this, second, the Prompt wouldn’t work, I couldn’t see it so I pull it in the head, third, If player and they are holding the tool the npc asked for then show him what npc ordered by a pointing arrow like on the npc’s hand and if the player gives the tool to a different npc then if the other npc ordered that then they chat Thanks and the other npc waits and if they waited for too long then they jump out there seat and go to WalktoWaiterPart then go to part Destroy to destroy the npc.
local Players = game:GetService("Players")
local ChatService = game:GetService("Chat")
local player = Players.LocalPlayer
local tool = script.Parent
local npcName = "Franklin Walking From Part To Part"
local npc = game.Workspace:FindFirstChild(npcName)
local prompt = npc and npc:FindFirstChildOfClass("ProximityPrompt")
local walkToPart = game.Workspace:FindFirstChild("WAlKtoWAITERpart")
local destroyPart = game.Workspace:FindFirstChild("Destroy")
if not (npc and prompt and walkToPart and destroyPart) then
warn("Ensure all required parts (NPC, ProximityPrompt, Walking part, Destroy part) are correctly named and available in the workspace.")
return
end
prompt.Enabled = true
local responses = {
"I didn't order this",
"Order Received",
}
local orderReceived = responses[2]
local notOrdered = responses[1]
local function chatWithNpc(npc, text)
ChatService:Chat(npc.Head, text, Enum.ChatColor.White)
end
local function onToolGiven()
tool.Parent = npc.Backpack
npc:EquipTool(tool)
player.Backpack:FindFirstChild(tool.Name):Destroy()
end
local function showArrowOnNpcHand(npc)
local arrow = Instance.new("Part")
arrow.Shape = Enum.PartType.Block
arrow.Size = Vector3.new(1, 1, 1)
arrow.Color = Color3.fromRGB(255, 0, 0)
arrow.Anchored = true
arrow.CanCollide = false
arrow.Position = npc.Head.Position + Vector3.new(0, 2, 0)
arrow.Parent = npc
-- Optional: Add some visual effect to make the arrow more noticeable
end
prompt.Triggered:Connect(function(triggeringPlayer)
if triggeringPlayer == player and tool.Parent == player.Character then
if orderReceived == notOrdered then
chatWithNpc(npc, notOrdered)
else
chatWithNpc(npc, "Thanks")
showArrowOnNpcHand(npc)
onToolGiven()
npc.Humanoid:MoveTo(walkToPart.Position)
npc.Humanoid.MoveToFinished:Wait()
wait(1)
npc.Humanoid:MoveTo(destroyPart.Position)
npc.Humanoid.MoveToFinished:Wait()
wait(1)
npc:Destroy()
end
end
end)
tool.Equipped:Connect(function()
prompt.Enabled = true
chatWithNpc(npc, "What do you want?")
end)
tool.Activated:Connect(function()
prompt.Enabled = true
chatWithNpc(npc, "What do you want?")
end)
theres one problem, it wont let the npc equip it and it just lands in random spots
local Players = game:GetService("Players")
local ChatService = game:GetService("Chat")
local player = Players.LocalPlayer
local tool = script.Parent
local npcName = "Franklin Walking From Part To Part"
local npc = game.Workspace:FindFirstChild(npcName)
local prompt = npc.Head:FindFirstChild("ProximityPrompt")
local walkToPart = game.Workspace:FindFirstChild("WAlKtoWAITERpart")
local destroyPart = game.Workspace:FindFirstChild("Detroy")
if not (npc and prompt and walkToPart and destroyPart) then
warn("Ensure all required parts (NPC, ProximityPrompt, Walking part, Destroy part) are correctly named and available in the workspace.")
return
end
prompt.Enabled = false
local responses = {
"I didn't order this",
"Order Received",
}
local orderReceived = responses[2]
local notOrdered = responses[1]
local function chatWithNpc(npc, text)
ChatService:Chat(npc.Head, text, Enum.ChatColor.White)
end
local function showArrowOnNpcHand(npc)
local arrow = Instance.new("Part")
arrow.Shape = Enum.PartType.Block
arrow.Size = Vector3.new(1, 1, 1)
arrow.Color = Color3.fromRGB(255, 0, 0)
arrow.Anchored = true
arrow.CanCollide = false
arrow.Position = npc.Head.Position + Vector3.new(0, 2, 0)
arrow.Parent = npc
-- Optional: Add some visual effect to make the arrow more noticeable
end
prompt.Triggered:Connect(function(triggeringPlayer)
if triggeringPlayer == player and tool.Parent == player.Character then
if orderReceived == notOrdered then
chatWithNpc(npc, notOrdered)
npc.Humanoid:MoveTo(walkToPart.Position)
npc.Humanoid.MoveToFinished:Wait()
wait(1)
npc.Humanoid:MoveTo(destroyPart.Position)
npc.Humanoid.MoveToFinished:Wait()
wait(1)
npc:Destroy()
else
wait(0.7)
chatWithNpc(npc, "Thanks")
player.Character.Humanoid:UnequipTools()
tool.Parent = npc
npc.Humanoid:EquipTool(tool)
tool:Activate()
player.Backpack:FindFirstChild(tool):Destroy()
end
end
end)
tool.Equipped:Connect(function()
prompt.Enabled = true
chatWithNpc(npc, "Is it mine?")
showArrowOnNpcHand(npc)
end)
tool.Activated:Connect(function()
chatWithNpc(npc, "What do you want?")
end)
can you help please?
Are there any errors in output? Upon first glance, it doesn’t seem like your code for when you give them the correct order should fully work. You don’t need to unequip the players tools or destroy the tool they already have. When you call the Humanoid:EquipTool(Tool) method, it will re-parent the tool to the character of the humanoid. Also, your player.Backpack:FindFirstChild(tool):Destroy() will error because FindFirstChild requires a string to search for.
Yes, use Humanoid:EquipTool(tool). And then don’t do anything else with the tool. Do not destroy it, or change it’s parent, or unequip it from your player character. Trying to do any of that will cause an error.
Make sure that the CanCollide property of the Handle is set to false. If possible, try giving it to the npc as they move around so I can better understand how it’s moving with them.
Please try giving the tool to the npc and then having them walk around so that I can better understand what’s going on. The tool seems to be fine when you’re holding it, so since it’s suddenly deciding to fly when equipped by the npc, I’d like to better understand what it’s doing.