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

How do I make a ProximityPrompt activate when equipping a tool?

Hi Developers, Today I have a Question, how and where can I set the ProximityPrompt to activate when a specific tool is equipped?

(The ProximityPrompt is script.Parent)

local db = true
local Robo1 = script.Parent.Parent.Parent.Robo1:GetChildren("RB1")
 
 
script.Parent.Triggered:Connect(function(plr)
	if db == true then
		db = false
		plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 250
		Robo1.Transparency = 1
		script.Parent.Parent.Parent.Sonido.S.Playing = true
		wait(5)
		Robo1.Transparency = 0
		db = true
	else
		if plr.PlayerGui:FindFirstChild("NoMoneyPrompt") then
			plr.PlayerGui:FindFirstChild("NoMoneyPrompt"):Destroy()
			local errorprompt = game.ReplicatedStorage.RobberyGUI.NoMoneyPrompt:Clone()
			errorprompt.Parent = plr.PlayerGui
			wait(1)
			errorprompt:Destroy()
		else
			local errorprompt = game.ReplicatedStorage.RobberyGUI.NoMoneyPrompt:Clone()
			errorprompt.Parent = plr.PlayerGui
			wait(1)
			errorprompt:Destroy()
		end
 
	end
end)

Thanks!

1 comment

0

You can use :FindFirstChild("ToolName") to check if player equip the tool!

1 answer

✓ Accepted answer

Using :FindFirstChild()

You can try using :FindFirstChild() to see if player equip the tool

If a Player use the tool, the tool will move from Player Backpack to the Player Character. So you can use :FindFirstChild() to the Player Character to check if player equip the tool.

Script:

local Tool = "ToolName"

script.Parent.Triggered:Connect(function(plr)
    if plr.Character:FindFirstChild(Tool) then
        print("Player Equip The Tool")
   end
end)

Haven't Tested It Yet!

Feel Free to Comment!

Thank's for Reading!

2 comments

0

Wait it work?

0

Nice

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