.Triggered event doesn't work 2nd time for proximity prompt

  1. What do you want to achieve?

For the .Triggered event to activate every time that it is triggered

  1. What is the issue?

What the portion of the script does is once the proximity prompt is triggered, it clones a model which is the holder of the proximity prompt and then it destroys the model. Even thought the script already sets the new variables correctly. The triggered event doesn’t seem to work. Be aware that the code that puts the bottles in the box is in the same script with the code that picks up the box (I can give the full script if requested).

Output from the video:

triggered
  1. What solutions have you tried so far?

I made sure to check if the “prox” was defined accurately by changing its name after the first triggered event, the name was changed without a problem.

I checked if the model that was cloned and the model already in place were the same, they weren’t so I fixed it and made them exact copies, still didn’t work.

Portion of the server script that picks it up:

prox.Triggered:Connect(function(player)
	print('triggered')
	local char = player.Character
	
	local clone = box:Clone() -- clones the box with bottles which is the box that will be carried
	clone.Parent = char
	
	local newBox = game.ReplicatedStorage.Box:Clone() -- creates new boxe and sets new variables
	newBox.Parent = workspace
	newBox:SetPrimaryPartCFrame(box:GetPrimaryPartCFrame())
	box:Destroy()
	box = newBox
	prox = box.ProxWall.ProximityPrompt
	
	player.CarryingBox.Value = true -- CarryingBox is used to check if the player is currently carrying a box
	
	char.RightHand.Name = "RightHandDisabled" -- cancels animation for the hands
	char.LeftHand.Name = "LeftHandDisabled"
	
	local anim = Instance.new("Animation",char) -- starts carrying animation
	anim.AnimationId = "rbxassetid://10284756356"
	local loadedAnim = char.Humanoid:LoadAnimation(anim)
	loadedAnim:Play()
	
	local cloneParts = clone:GetChildren()
	for _, v in pairs(cloneParts) do
		
		if v.ClassName == "Part" then
			
			v.Anchored = false
			v.CanCollide = false
			
		end
		
	end
	
	clone.ProxWall.ProximityPrompt.Enabled = false -- disables the carried boxes proximity prompt
	
	local part1 = clone.PrimaryPart
	for _, part0  in pairs(clone:GetChildren()) do 
		
		if part0:IsA("Part") and not (part0 == part1) then -- welds the box together
			
			local weldC = Instance.new("WeldConstraint")
			weldC.Part0 = part0
			weldC.Part1 = part1
			weldC.Parent = weldC.Part0
			
		end
		
	end
	
	local weld = Instance.new("Weld", clone) -- welds the box to the player
	weld.Part0 = clone.PrimaryPart
	weld.Part1 = char.Spawner -- the spawner is something made by the script to properly set the angle of the weld
	
	for _, dropOff in pairs(dropOffList) do -- turns on proximity prompts that are drop off points for the box
		dropOff.Enabled = true
	end
	
	rowCount = 0 -- resets values 
	currentBottleRowCount = 0
	bottleCount = 0
	parentMold = nil
	initialMold = nil
	initialMoldCount = 0
	layerCount = 1
	maxed = false
	
end)

Server Script that puts box in back of the truck:

local prox = script.Parent.Frame.TrunkDoor.DropOff
local pickup = script.Parent
local templates = pickup.Templates

local pricings = {
	StandardBottle = .5
}

local templateStatus = {
	[1] = false;
	[2] = false;
	[3] = false;
	[4] = false
}

local templateValues = {
	[1] = templates.BoxTemplate1;
	[2] = templates.BoxTemplate2;
	[3] = templates.BoxTemplate3;
	[4] = templates.BoxTemplate4
}

prox.Triggered:Connect(function(player)
	
	if player.Character:FindFirstChild("Box") then
		
		local price
		local availableTemplate
		
		local box = player.Character.Box
		
		for _, v in pairs(box:GetChildren()) do
			
			if pricings[v.Name] then -- gets price of object in the box
				price = pricings[v.Name]	
				break
			end
			
		end
		
		for i, T in next, templateStatus do -- finds a template for the box to spawn at
			if not T then
				availableTemplate = i
				T = true -- sets the T# to occupied (true)
				break
			end
		end
		
		local weld = box.Weld
		weld.Part1  = templateValues[availableTemplate].Floor -- welds box to template
		
		for _, track in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do -- cancels carrying animation
			if track.Animation.AnimationId == "rbxassetid://10284756356" then
				track:Stop()
			end
		end
		
		player.CarryingBox.Value = false
		
		player.Character.RightHandDisabled.Name = "RightHand"
		player.Character.LeftHandDisabled.Name = "LeftHand"
		
		player.Character.Spawner:Destroy()
		prox.Enabled = false
		
	end
	
end)