I have a door script, that opens the door when you click the click detector. Pretty simple. But, for my game, I need it so only people on a specific team can open the specific door. And also, Multiple teams to open one door would be good. I have a Server Script inside of the click detector that sends info to the other Server Script to actually make the thing move. But, Why isn't this working still?
Original script, (Working):
game.ServerScriptService.RegisterToDoorService:Invoke(script)
New script, (Not working.):
script.Parent.ClickDetector.MouseClick:Connect(function(plr) if plr.Team == "Patient" then game.ServerScriptService.RegisterToDoorService:Invoke(script) end end)
It is because the Team property of Player returns the Team instance. You can fix this by simply adding ".Name".
Fixed script:
script.Parent.ClickDetector.MouseClick:Connect(function(plr) if plr.Team.Name == "Patient" then game.ServerScriptService.RegisterToDoorService:Invoke(script) end end)