"ProximityPrompt enabled when tool is equipped" does not work

Hey! I made a script today but it didn’t work and gave out an error in output. Basically what I want to do is that when a tool is equipped the proximitypromt is enabled and when it is unequipped the proximitypromp is disabled

local ProximityPrompt = script.Parent

local CasetteModel = workspace.Cassette_Tape

local Tool = game.Players.LocalPlayer.Backpack.CassetteTape

local Value = script.Parent.Parent.Value

ProximityPrompt.Enabled = false

Value = false

Tool.Equipped:Connect(function(mouse)

Value = true

end)

Tool.Unequipped:Connect(function()

Value = false

end)

if Value == true then

ProximityPrompt.Enabled = true

elseif Value == false then

ProximityPrompt.Enabled = false

end

You’re writing your code in a server script.

To use game.Players.LocalPlayer, the script needs to be a local script, not a server script.

There are a couple other problems with your code. For one, your if statement for checking Value only runs once.

You’ll instead want to do write this in a local script in the tool:

local proximityPrompt = workspace.PromimityPrompt -- Change this
local tool = script.Parent

tool.Equipped:Connect(function()
    proximityPrompt.Enabled = true
end)

tool.Unequipped:Connect(function()
    proximityPrompt.Enabled = false
end)

Oooh i will try it out and update you

It still doesn’t work for some reason
image

and i updated the script and made it local

local ProximityPrompt = script.Parent
local CasetteModel = workspace.Cassette_Tape
local Tool = game.Players.LocalPlayer.Backpack.CassetteTape
local Value = script.Parent.Parent.Value

ProximityPrompt.Enabled = false
Value.Value = false

Tool.Equipped:Connect(function(mouse)
	Value.Value = true
end)

Tool.Unequipped:Connect(function()
	Value.Value = false
end)

if Value.Value == true then
	ProximityPrompt.Enabled = true

elseif Value.Value == false then
	ProximityPrompt.Enabled = false
end

Please look at my code in the second post. You still have some errors in your code.

Wait hold on i didn’t see the edit you made