0

# How to execute a ProximityPrompt script that destroys the item you have equipped?

I'm trying to make a Trashcan that has a Proximity Prompt, that let's you destroy the tool that you have currently equipped. I need help finishing this script.

local KeyPart = script.Parent local Prompt = KeyPart.ProximityPrompt

Prompt.Triggered:Connect(function(player) local bp = player.Backpack if bp:FindFirstChild("Keycard") then --- then what??

end


end)

0
NGC4637 227
5 days ago
Edited 5 days ago

edit: nvm i see you are doin something different

local KeyPart = script.Parent
local Prompt = KeyPart.ProximityPrompt

Prompt.Triggered:Connect(function(player)
local chr = game.Workspace:FindFirstChild(player.Name)
if chr:FindFirstChildWhichIsA("Tool") then
chr:FindFirstChildWhichIsA("Tool"):Destroy()
else
return
end
end)

0
bro, you are such a legend. you are a miracle worker! like man thanks for the past 2 scripts. you are big brain. and i praise you for that! this will help me out in the future. superbubba2020 6 — 5d
0
no probs. I 'm not actually that skilled. I would say i'm intermediate in lua. NGC4637 227 — 5d
0
compared to me, you're way more skilled than I am. I started to learn about lua like a week ago, so i don't know that much compared to you. but anyways, thanks alot! superbubba2020 6 — 5d
0
I tried your Dimension RPG out, i think it's pretty sick! you're way more skilled than i am superbubba2020 6 — 5d
0
thx NGC4637 227 — 5d
0
Edited 5 days ago

Well, you have to be More especific, but, From what i understand, I've created a Script to make it.

local Proximity = script.Parent --Here the Localization of the Proximity Prompt.
local Stuff = " " --Here the Tool name from a String.
local BackPack = game.Players.LocalPlayer.Backpack

Proximity.Triggered:Connect(function()
if BackPack:FindFirstChild(Stuff) then
BackPack:FindFirstChild(Stuff):Destroy()
else
print("There is nothing :/")
end
end)

0
If you have Questions or Some error, Please post It. sebtantin 15 — 5d
0
First it says, Player is not a valid member of DataModel "Testing my scripts" - Server - Prompt:3 superbubba2020 6 — 5d
0
I wrote It wrong UwU sebtantin 15 — 5d
0
Now is Apparently Solved, it Was "Players" not "Player". sebtantin 15 — 5d
0
it says 18:32:26.723 Workspace.Trashcan.Attachment.Prompt:3: attempt to index nil with 'BackPack' - Server - Prompt:3 superbubba2020 6 — 5d
0
Ok, I'll Check that. sebtantin 15 — 5d
0
wait, i accidently did BackPack and not Backpack superbubba2020 6 — 5d
0
Do i put this script in a localscript? or just a normal? superbubba2020 6 — 5d
0
dude, scripts cannot do local player :vvvvvvv and local scripts don't work outside the player and player's character. You have to make use of the triggered event's parameter called player NGC4637 227 — 5d
0
dude, scripts cannot do local player :vvvvvvv and local scripts don't work outside the player and player's character. You have to make use of the triggered event's parameter called player which returns the player who triggered the prompt NGC4637 227 — 5d