I made this scanner script that'll set an alarm off if you're not in the group, but it does it for everyone. Please help!
Disabler.MouseClick:Connect(function() Alarm:Stop() print("Alarm on") Light1.BrickColor = BrickColor.new("Dark green") Light2.BrickColor = BrickColor.new("Dark green") Light3.BrickColor = BrickColor.new("Dark green") wait(.001) Light1.BrickColor = BrickColor.new("Bright red") Light2.BrickColor = BrickColor.new("Bright red") Light3.BrickColor = BrickColor.new("Bright red") Alarm:Play() wait(26) Light1.BrickColor = BrickColor.new("Dark green") Light2.BrickColor = BrickColor.new("Dark green") Light3.BrickColor = BrickColor.new("Dark green") Alarm:Stop() print("Alarm off") end) Scanner.Touched:Connect(function(Player) if debounce == false then debounce = true Scan:Play() Scanner.Transparency = .8 wait(.6) Scanner.Transparency = .9 if Rank <= 1 then print("Alarm on") Alarm:Stop() Light1.BrickColor = BrickColor.new("Dark green") Light2.BrickColor = BrickColor.new("Dark green") Light3.BrickColor = BrickColor.new("Dark green") wait(.001) Light1.BrickColor = BrickColor.new("Bright red") Light2.BrickColor = BrickColor.new("Bright red") Light3.BrickColor = BrickColor.new("Bright red") Alarm:Play() wait(26) Light1.BrickColor = BrickColor.new("Dark green") Light2.BrickColor = BrickColor.new("Dark green") Light3.BrickColor = BrickColor.new("Dark green") Alarm:Stop() print("Alarm off") end debounce = false end end) end)
Thanks if you can help
You can solve this problem by using server script and remote event, When you use a remote event then it will make the script working on both server and client.
Go to the top of the script and type this:
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- finds ReplicatedStorage local createPartEvent = Instance.new("RemoteEvent") -- Creates the event createPartEvent.Name = "AlarmEvent" -- The name of the event createPartEvent.Parent = ReplicatedStorage -- places the event on ReplicatedStorage
This may work for you as it did for me. Hope it helped!
Use player:IsInGroup() instead of rank
local groupId = 0 --group id if plr:IsInGroup(groupId) then else print("Alarm on!") end