Value isn't returning from module script

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.

Way off .. I’m trying to fix a wheel that isn’t broken. Deleted.

I recreated your setup and used your code you posted, it seems to work fine for me.

Here is the place file I used in the video. I set up the scripts you posted as server scripts.
Place1.rbxl (63.5 KB)

Although FYI your code could end up with allowing them to pick up multiple objects if another request comes in while the server is still waiting for the invoked client to return from the last request, e.g. you might need a debounce per-user to reject a pickup if they have another ongoing pickup, or queue it up, or parent the item clone immediately before invoking the client animation if you don’t care about the client’s return value.

I forgot to say that the triggered script is server sided parented to the proximity prompt. the module is a server module too.

I tested this setup with a simple ProximityPrompt and remote invocation, and it correctly returns “Success” when the item is grabbed and “Failed” if the player already has it. The prompt re-enables immediately on failure, so it works for repeated attempts.

That’s a new one on me.. the problem isn’t a problem. Time to check other things going on.
(Btw, breaking that down with prints like that is all pro.)