#Proximity prompt isn’t working
1 messages · Page 1 of 1 (latest)
script in tool to make prompt show. ```lua
local Player = game:GetService("Players").LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local SoilBag = script.Parent.Parent
local id = "ProximityPrompt"
local ProxPrompt = {}
local Uses
for _, v in pairs(SoilBag:GetChildren()) do
if v:IsA("NumberValue") and v.Name == "Value" then
Uses = v
break
end
end
if not Uses then
warn("No NumberValue named 'Value' found in SoilBag!")
return
end
local function updatePrompts()
ProxPrompt = {}
local playerPlot = workspace.Plots[Player.Name .. "Plot"]
if playerPlot then
for _, pot in pairs(playerPlot.Furniture:GetChildren()) do
if string.find(pot.Name, "Empty") then
for _, prompt in pairs(pot:GetDescendants()) do
if prompt:IsA("ProximityPrompt") and prompt.Name == id then
table.insert(ProxPrompt, prompt)
end
end
end
end
else
warn("Player's plot not found!")
end
end
updatePrompts()
local function onEquipped()
updatePrompts()
for _, v in pairs(ProxPrompt) do
v.Enabled = true
end
end
SoilBag.Equipped:Connect(onEquipped)
local function onUnEquipped()
for _, v in pairs(ProxPrompt) do
v.Enabled = false
end
end
SoilBag.Unequipped:Connect(onUnEquipped)
Uses:GetPropertyChangedSignal("Value"):Connect(function()
print("New value: " .. Uses.Value)
if Uses.Value <= 0 then
onUnEquipped()
task.wait(0.1)
SoilBag:Destroy()
end
end)
What have you changed and/or do you have a version of the game from 2+ days ago you can revert to and see whats changed since then?