I'm trying to make a door that'll sound an alarm when It's touched, but only for non-group members. Whenever you walk through it nothing happens at all; nothing pops up in the output either. I also have a button that will play the sound when clicked, but only when the value is false, and if it is true, it'll stop the sound. Here's my script:
game.Players.PlayerAdded:Connect(function(Player)
local Rank = Player:GetRankInGroup(3738720)
local debounce = false
local Assets = script.Parent.Assets
local Scan = Assets.Scan
local Hum = Assets.Hum
local Alarm = Assets.Alarm
local Light1 = script.Parent.Light1
local Light2 = script.Parent.Light2
local Light3 = script.Parent.Light3
local Scanner = script.Parent.Scanner
local Enabled = Assets.Enabled
local Disabler = script.Parent.Disable.ClickDetector
Alarm.Parent = workspace
Disabler.MouseClick:Connect(function()
Enabled = false
end)
Disabler.MouseClick:Connect(function()
if Enabled == false then
Enabled = true
end
end)
Scanner.Touched:Connect(function()
if debounce == false then
debounce = true
Scan:Play()
wait(.6)
if Rank >= 1 then
Enabled = true
Enabled.Changed:Connect(function()
if Enabled == true then
workspace.Alarm:Play()
print("True")
if Enabled == false then
workspace.Alarm:Stop()
print("False")
end
end
debounce = false
end)
end
end
end)
end)
Thanks if you can help me out, it would help!
