Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make proximity prompt shows its own tool name?

This script is located in the ServerScriptService and I have all of these variety of tools, guns etc.

I want the ObjectName to be unique and give individual tools showing their own name, but every other tool says "Tool" as the object name.

So in conclusion, how do I make it so it shows it's own name? I forgot and I don't know what it's really called for it.

local pps = game:GetService("ProximityPromptService")


local distance = 5
local timeToHold = 0


pps.PromptTriggered:Connect(function(pp, plr)
	
	local tool = pp.Parent.Parent
	if tool:IsA("Tool") then
		
		tool.Parent = plr.Backpack
		
		pp:Destroy()
	end
end)


while wait() do
	
	
	for i, descendant in pairs(workspace:GetDescendants()) do
		
		if descendant:IsA("Tool") and descendant:FindFirstChild("Handle") and not game.Players:GetPlayerFromCharacter(descendant.Parent) then
			
			
			if descendant.Handle:FindFirstChild("TouchInterest") then descendant.Handle.TouchInterest:Destroy() end
			
			
			local pp = descendant.Handle:FindFirstChild("ProximityPrompt")
			
			if not pp then
				
				pp = Instance.new("ProximityPrompt")
				pp.MaxActivationDistance = distance
				pp.HoldDuration = timeToHold
				pp.RequiresLineOfSight = false
				pp.ObjectText = "Tool"
				pp.ActionText = "Pick Up"
				
				pp.Parent = descendant.Handle
			end
		end
	end
end

It has something to do with line 39 "pp.ObjectText = "Tool"" but in the quotation marks, I forgot how to put the tool name that is being picked up.

1 answer

✓ Accepted answer

try doing

pp.ObjectText = Tool.Name

4 comments

0

I did, but the "Tool

0

You dont put "" around Tool.Name.

0

Since Tool.Name returns a string, you don't need to put "" around it

0

Sorry for the really late reply! Firgured it out that if I added Local Tool = descendant then it works fine

This discussion is preserved as it was. New answers, comments, and votes are closed.