I am making a item grabbing system using proximity prompts, everything except that the checks that return “Failed” doesnt return any result in the triggered script.
When I grab the second plunger, it returns “Failed” which should re-enable the prompt but that doesnt work. The output prints the result only if it’s “Success”
Prompt.Triggered:Connect(function(player)
Prompt.Enabled = false
local result = Module.GrabItem(player, Prompt, Prompt.Parent)
print("RESULT: ", result) --This only prints is result = "Success"
if result == "Failed" then
Prompt.Enabled = true
end
end)
Server Grab Module:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Event = Remotes:WaitForChild("GrabItemAnim")
local grab = {}
function grab.GrabItem(player, Prompt: ProximityPrompt, PhysicalItem: BasePart | Model)
if not Prompt or not Prompt:IsA("ProximityPrompt") or typeof(PhysicalItem) ~= "Instance" then
return "Failed"
end
local PromptItem = Prompt:FindFirstChild("Item")
if not PromptItem or not PromptItem:IsA("ObjectValue") then
return "Failed"
end
local Item = PromptItem.Value
if not Item or not Item:IsA("Tool") then
return "Failed"
end
local backpack = player:FindFirstChild("Backpack")
if not backpack then
return "Failed"
end
local character = player.Character
if not character then
return "Failed"
end
if character:FindFirstChild(Item.Name) or backpack:FindFirstChild(Item.Name) then
print("already in backpack")
return "Failed"
end
print("got past")
PhysicalItem:Destroy()
local animationCompleted = Event:InvokeClient(player, Item.Name)
if animationCompleted then
Item:Clone().Parent = backpack
end
return "Success"
end
return grab
I tried removing the debounce system since I didnt need it anyways, but that made no difference.