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.