Hi, I am making a Inventory System and when i try to destroy a ProximityPromp Roblox Studio Crash with no error message
this is the full code, to repliclated u need create a part with one Attribute called itemType
and just move closer and later move away until the box disappears
-- Servicios --
local Players = game:GetService("Players")
local Debris = game:GetService("Debris")
local RS = game:GetService("ReplicatedStorage")
-- Variables --
local plr = Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
local eventsFolder = RS:WaitForChild("Events")
-- Funciones --
function FilterItem(i) --Comprueba si es un Objeto
local itemType = i:GetAttribute("itemType")
if itemType and not i:FindFirstChildOfClass("ProximityPrompt") then
local Promp = Instance.new("ProximityPrompt", i)
Promp.MaxActivationDistance = 8
Promp.ActionText = "Get"
Promp.ObjectText = i.Name
Promp.UIOffset = Vector2.new(0, 80)
Promp.PromptHidden:Connect(function()
Promp:Destroy()
end)
end
end
function GetItem()
end
while task.wait(0.25) do
local RP = chr:FindFirstChild("HumanoidRootPart")
if RP then
local region = Region3.new(RP.Position - 9 * Vector3.one, RP.Position + 9 * Vector3.one)
local items = workspace:FindPartsInRegion3WithIgnoreList(region,{chr,camera})
for _, i in items do
FilterItem(i)
end
end
end
I don’t know if this error is mine or it is a Studio error