Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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!

0
You can use :FindFirstChild("ToolName") to check if player equip the tool! The_Saver31 260 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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!

0
Wait it work? The_Saver31 260 — 3y
0
Nice The_Saver31 260 — 3y
Ad

Answer this question