Team lock not working

This is my script. It is a script firing an event (Local script in SPS). The main issue is that my team lock isn’t working.

Team lock as in only people that are on the team “Medical Staff” can fire the event.

I tried separating the if statements, but still doesn’t work, no errors.

QueueBuzz = function(plr, pc)
		if not plr or not pc or plr.Team.Name ~= "Medical Staff" then return end

		local ticket = getTicketFromRoom(pc)
		if ticket then
			RS.QueueBuzz:FireClient(ticket.plr, pc)
		end
	end,

First of all, you should try and make this a server sided script
Reason for that being that exploiters can exploit this to make the server think they’re on a team they aren’t

But for now, try changing it to this

QueueBuzz = function(plr, pc)
		if plr and pc then
			if plr.Team.Name == "Medical Staff" then
				local ticket = getTicketFromRoom(pc)
				if ticket then
					RS.QueueBuzz:FireClient(ticket.plr, pc)
				end
			end
		end
	end,

Haven’t tested that, because i can’t, but hopefully it works for you

1 Like

The issue with that if statement is that if the “plr” exists, it’ll stop the if statement. Same with the “pc”
I wouldn’t have more than one “or” in an if for this reason

Sorry, typo. I meant this is a server script in SSS and firing an event.

1 Like

Doesn’t work.char limit

Try having only the statement that checks if they’re on the right team, if that doesn’t work, it could be something else that’s gone wrong

Doesn’t work, too. Weird.char limit

I’m sorry, I’m not that experienced, and i don’t have all the code, I don’t think i can help. Good luck with your project though!

1 Like