im trying to manage multiple proximity prompts but they wont show or hide. sometimes it works but sometimes it doesnt.
module script:
function module.PromptVisibility()
local function claimTree(p)
print("Tree was claimed by: " .. p.Name .. "!")
end
for _, tree in pairs(tree_folder:GetChildren()) do
if tree:IsA("BasePart") then
local claim_UI = tree:FindFirstChild("claim_UI")
if claim_UI and claim_UI:IsA("BillboardGui") then
for _, instance in pairs(tree:GetChildren()) do
if instance:IsA("ProximityPrompt") then
instance.PromptShown:Connect(function()
claim_UI.Enabled = true
end)
instance.PromptHidden:Connect(function()
claim_UI.Enabled = false
end)
end
end
end
end
end
end
local script in startercharacterscripts:
local tree_module = require(game.ReplicatedStorage:WaitForChild("tree_module"))
local p = game.Players.LocalPlayer
if p.Character then
tree_module.PromptVisibility()
end