Why does this script not detect the proximity prompt?

I’m making a script where when the proximity prompt is triggered it “harvests” the crop. using this code

local prox = script.Parent.Hitbox.ProximityPrompt

prox.Triggered:Connect(function(player)
	local Wheat = game.ServerStorage.ItemsFolder.Wheat
	local wheatPlot = script.Parent
	local String = Instance.new('StringValue')
	Wheat.Handle.Transparency = 0
	Wheat.Part.Transparency = 0
	Wheat.Part1.Transparency = 0
	Wheat.Part2.Transparency = 0
	Wheat.Part3.Transparency = 0
	Wheat.Handle.Anchored = false
	Wheat.Part.Anchored = false
	Wheat.Part1.Anchored = false
	Wheat.Part2.Anchored = false
	Wheat.Part3.TAnchored = false
	String.Name = 'Wheat'
	String.Parent = player:WaitForChild('Inventory')
	Wheat.Parent = player.Backpack
	wheatPlot:Destroy()
end)

image
When i tested it. Nothing happened. I thought it was a little error so i tried using prints to find the line that was wrong since it didn’t give an error but I looked into it more and found out the script can’t even find the proximity prompt

Whats going on???

Were there any errors in the output window?

No, Thats why i was trying to debug it using prints

this is happening because there are 2 or more child named Hitbox under the parent PlotExample_1

Oh, i used an autoweld tool earlier to weld everything. I guess i forgot that it names the welds to the same name as the part it is welding to

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.