I don't know how to explain this very well, but it is a door that when a non-group member or rank 1 group member passes through it'll solidify and kill anyone who touches it while setting an alarm off, but if you are a group member and you have the rank 2+ then it'll let you through without anything happening. The door part works, but the sound will only play once if you are in the group and have a rank of 2+.

game.Players.PlayerAdded:connect(function(Player)
local Rank = Player:GetRankInGroup(4087912)
local Enter = script.Parent.Enter
local shield = script.Parent
local debounce = false
local kill = shield.Kill
local flash = script.Parent.Flash

shield.Touched:Connect(function()
	if debounce == false then 
            debounce = true
	Enter:Play()
if Rank == 0 or Rank == 1 then	
	workspace.AlarmSound:Play()
	wait(.6)
	flash.Disabled = true
	kill.Disabled = false
	shield.CanCollide = true
	shield.Transparency = .5
	wait(.005)
	shield.Transparency = .4
	wait(.005)
	shield.Transparency = .3
	wait(.005)
	shield.Transparency = .2
	wait(.005)
	shield.Transparency = .1
	wait(.005)
	shield.Transparency = 0
	wait(35)
	kill.Disabled = true
	flash.Disabled = false
	workspace.AlarmSound:Stop()
	debounce = false
end
end
end)
end)

Thanks if you can help.

5 comments

0

Sorry for not explaining what the "Sound" is, it's supposed to be an effect for when you walk through.

0

After all these times, you’re not using Connect. It’s Connect not connect!

0

Oh I use an old script I made it has connect so I don't change it, plus it works either way so I don't see the big deal. If it gets deprecated I can just go in and fix it.

0

I also found the problem I put end in the wrong spot

0

@CaptainAlien132, you could've simplified some of the code with a number for loop