Hello, i have this issue where if i mine my tree it does spawn a log but my script wont activate the proximity prompt to collect it.
anybody got a idea why?
here is my code:
local label = script.Parent.Health
local treeStem = script.Parent
local swingsLeft = 10
local function onTouch(otherPart)
local tool = otherPart.Parent
if tool:IsA('Tool') and tool.Hitting.Value == true then
swingsLeft -= 1
label.GreenHealth.Size = UDim2.new(swingsLeft/10, 0, 1, 0)
end
if swingsLeft <= 0 then
if script.Parent.Parent:FindFirstChild("Leaves") then
script.Parent.Parent.Leaves:Destroy()
script.Parent.Parent.Leaves2:Destroy()
script.Parent.Parent.Leaves3:Destroy()
script.Parent.Parent.Leaves4:Destroy()
script.Parent.Parent.Wood:Destroy()
script.Parent.Parent.Wood2:Destroy()
script.Parent.Parent.Wood3:Destroy()
script.Parent.Parent.TreeStem:Destroy()
end
script.Parent.Health.Enabled = false
if script.Parent.Parent.TreeStem2.ProximityPrompt.Enabled == true then
script.Parent.Parent.TreeStem2.ProximityPrompt.Enabled = true
end
end
end
treeStem.Touched:Connect(onTouch)
here is a picture where all my stuff is parented and childed to:

anybody know the issue?