I have tried various solutions, even keycards and such but I'm completely lost. Here's my code:
function onClicked () script.Parent.Parent.Parent.Parent.mistake.m.HingeConstraint.TargetAngle = -90 wait(3) script.Parent.Parent.Parent.Parent.mistake.m.HingeConstraint.TargetAngle = 0 end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The script is functional, but I'd like for it to only work when certain (several) teams click on it.
You need to check the team before opening the door
local TeamName = "" -- Make sure your teams are in the teams folder function onClicked (Player) if Player.Team.Name == Team.Name then script.Parent.Parent.Parent.Parent.mistake.m.HingeConstraint.TargetAngle = -90 wait(3) script.Parent.Parent.Parent.Parent.mistake.m.HingeConstraint.TargetAngle = 0 end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
script.Parent.ClickDetector.MouseClick:connect(onClicked)
This line is wrong.
The lowercase :connect() is depricated. Use :Connect(), scripting is case-sensitive as you should know. And check the above answer to check the team.
Closed as Not Constructive by Leamir
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?