What is the issue?
Every Proximity Prompt in my place doesn’t work after a few uses. I have tried searching on the forum but nothing came for my problem.
I have no idea why is this happening.
Here is the script for the light proximity prompt switch.
local lighter = script.Parent.Parent.Parent.Parent.Light.LightPart.SurfaceLight
local ON = true
local sfx = script.Parent.Parent.sfx
script.Parent.Triggered:Connect(function()
if ON then
ON = false
sfx:Play()
lighter.Enabled = true
elseif ON == false then
ON = true
sfx:Play()
lighter.Enabled = false
end
end)
Its very likely because you’re spamming it. Add a system which prevents users from spamming:
local lighter = script.Parent.Parent.Parent.Parent.Light.LightPart.SurfaceLight
local ON = true
local sfx = script.Parent.Parent.sfx
script.Parent.Triggered:Connect(function()
if ON then
ON = false
sfx:Play()
lighter.Enabled = true
script.Parent.Enabled = false
wait(2) -- change this value
script.Parent.Enabled = true
elseif ON == false then
ON = true
sfx:Play()
lighter.Enabled = false
script.Parent.Enabled = false
wait(2) -- change this value
script.Parent.Enabled = true
end
end)