Hello, I am currently working on a door for prison game where if you are a cop it opens up but if you are a prisoner or criminal it makes a doorknob sound.
For some reason, when I use the door as a prisoner it opens up and the same thing happens as a cop.
I’ve looked at some discussions on scripting helpers and some on here but it still hasn’t solved my problem.
Here is the code:
local cd = script.Parent
local door = cd.Parent.Parent.Door
local function onClick(player)
if player.Team == game:GetService("Teams").Prisoner then
print("they are a prisoner or criminal")
door.Transparency = 1
door.CanCollide = false
door.Transparency = 0
door.CanCollide = true
print("they are a cop")
It’s an issue regarding checking if the player is on the prisoner’s team (if player.Team == game:GetService("Teams").Prisoner then). You can attempt checking for the TeamColor, followed by the prisoner’s colour, and see if that makes a change.