#proximity prompt and toggle are not working

1 messages · Page 1 of 1 (latest)

odd vine
#

SOLVED, IT DOESN'T ALLOW ME TO CHANGE TAGS!!

script.Parent.Triggered:Connect(function()
local enabled = false

script.Parent.Parent.Parent.Part2.Transparency = 0.6
enabled = true
if enabled == true then
script.Parent.Parent.Parent.Part2.Transparency=0
end
end)

what it's supposed to do : You touch the proximity prompt, and then on another part, called Part 2, will go transparent. Afterwords, if you hit that proximity prompt again, it will become transparency 0 again. This isn't working.

ancient island
#

define the variable enabled outside of the function

#

wehn you press the proximity prompt it always resets the variable to false

#
  • you need to check if the variable is true before setting it to true
#
local enabled = false

function()
    if enabled then
        enabled = false
        --deactivate shit
    else
        enabled = true
        --activate shit
    end
end
#

@odd vine