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

How to make a Proximity Prompt appear and do function when the player has a tool?

Asked by 1 year ago

I've tried detecting the player backpack for the tool name and if it does detect it I made it to where the Proximity Prompt should be allowed to be triggered. I may be going in a completely wrong direction. Here's my code:

local ProximityPromptService = game:GetService("ProximityPromptService") local ToolName = "Wrench" local core = script.Parent.Parent.Effect.Core local coreMiniSparks = script.Parent.Parent.Effect.CoreMiniSparks local miniSparks = script.Parent.Parent.Effect.MiniSparks local sparks = script.Parent.Parent.Effect.Sparks game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) if player.Backpack:FindFirstChild(ToolName) then script.Parent.Triggered:Connect(function() core.Enabled = false coreMiniSparks.Enabled = false miniSparks.Enabled = false sparks.Enabled = false end) end end)

end)

0
Please, use a code block instead of plain text... It's hurting my eyes. NotThatFamouss 605 — 1y
0
So, you want to enable a proximity prompt when you equip the tool? MarkedTomato 810 — 1y

2 answers

Log in to vote
0
Answered by 1 year ago
local ProximityPromptService = game:GetService("ProximityPromptService")
local ToolName = "Wrench"
local core = script.Parent.Parent.Effect.Core
local coreMiniSparks = script.Parent.Parent.Effect.CoreMiniSparks
local miniSparks = script.Parent.Parent.Effect.MiniSparks
local sparks = script.Parent.Parent.Effect.Sparks
game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if player.Backpack:FindFirstChild(ToolName) then
            script.Parent.Triggered:Connect(function()
                core.Enabled = false
                coreMiniSparks.Enabled = false
                miniSparks.Enabled = false
                sparks.Enabled = false
        end)
    end
    end)
end)

here's his script ina code block if anyone wants to help

0
off the top of my head, my suggestion would be to use a debounce to allow ur ProximityPrompt to be enabled ZeroToH3ro 82 — 1y
Ad
Log in to vote
0
Answered by 1 year ago
local ToolName = "Wrench" 
local core = script.Parent.Parent.Effect.Core
local coreMiniSparks = script.Parent.Parent.Effect.CoreMiniSparks local miniSparks = script.Parent.Parent.Effect.MiniSparks
local sparks = script.Parent.Parent.Effect.Sparks
script.Parent.Triggered:Connect(function(player)
local backpack,char=player:FindFirstChild"Backpack",player.Character
local tool=backpack and backpack:FindFirstChild(ToolName)or char and char:FindFirstChild(ToolName)
if tool then
coreMiniSparks.Enabled = false 
miniSparks.Enabled = false 
sparks.Enabled = false
end
end)
0
I think it's easier to do if a player has a tool then proximity prompt will work then if doesn't have then it won't AltairCelestia 47 — 1y

Answer this question