I am making a simple script that when you activate the prompt, it plays a sound and changes the color of the screen (basically turning it on). When you click it again, it turns it off.
EDIT: I fixed the issue, but now, once you turn it off, it doesn't turn back on!
local Sound1 = script.Parent:WaitForChild("monitor_on")
local Sound2 = script.Parent:WaitForChild("monitor_off")
local Sound3 = script.Parent:WaitForChild("comp_windup")
local screenOn = true
local function onPromptTriggered(player)
if screenOn then
Sound1:Play()
wait(0.1)
Sound3:Play()
script.Parent.BrickColor = BrickColor.new(58/255, 125/255, 21/255)
script.Parent.ProximityPrompt.ObjectText = "Turn Off!"
else
Sound1:Stop()
Sound3:Stop()
Sound2:Play()
script.Parent.BrickColor = BrickColor.new(17/255, 17/255, 17/255)
script.Parent.ProximityPrompt.ObjectText = "Turn On!"
end
screenOn = false
end
script.Parent.ProximityPrompt.Triggered:Connect(onPromptTriggered)
