Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this work in studio but not in game? [Filtering Enabled]

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

4 comments

0

Is this a Server Script or Local Script?

0

Cause if it's Server, it's gonna do it for everyone, while if its Local, it will do it for one person.

0

I'll try a Local Script

0

Nothing happens

2 answers

✓ Accepted answer

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!

2 comments

0

Ty

0

You're welcome

Use player:IsInGroup() instead of rank

local groupId = 0 --group id
if plr:IsInGroup(groupId) then

else
	print("Alarm on!")
end

This discussion is preserved as it was. New answers, comments, and votes are closed.