I have a bool value in workspace and I am trying to detect when that value is changed. I have a proximity prompt handler in server script service that when the proximity prompt is activated it changes the bool value to true. At the start of the script it creates the value, it's not already in workspace. There is then a local script in StarterGui that then detects when the value is changed and runs code based on that. I am getting this error: Players.electrocat56.PlayerGui.ProximityPromptDisabler:4: attempt to index function with 'Changed'
Proximity Prompt Handler Code
local ProximityPromptService = game:GetService('ProximityPromptService')
local value = Instance.new('BoolValue')
value.Parent = workspace
value.Name = 'Destroy'
value.Value = false
local function onPromptTriggered(promptObject, player)
promptObject.Parent.Parent.Disabled = false
player.Character.HumanoidRootPart.CFrame = CFrame.new(promptObject.Parent.Parent.Position)
value.Value = true
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)
The Local Script
local boolValue = workspace.Destroy
wait(5)
boolValue.Changed:Connect(function(property)
if property == 'Value' then
if boolValue.Value == true then
boolValue.Value = false
game.Players.LocalPlayer.PlayerGui.ProximityPrompts:Destroy()
print('Hidden Proximity Prompts')
end
end
end)
I have no idea why this is erroring as I have another script that uses a .Changed function that works perfectly.

1 comment
I've done this, and no longer get the error, but when the value changes, the script doesn't detect it