My goal here is to remove all accessory of a player who triggered the proximity prompt however my scripts seems to be not working:
local prompt = script.Parent
function onPromptTriggered(triggerPart)
local player = game.Players:GetPlayerFromCharacter(triggerPart.Parent)
if player and player.Character then
for _, accessory in ipairs(player.Character:GetChildren()) do
if accessory:IsA("Accessory") then
accessory:Destroy()
end
end
end
end
prompt.Triggered:Connect(onPromptTriggered)
I hope somebody can help since I have not scripted for a while and I am trying again,