Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make my door open for certain teams only? [closed]

Asked by 3 years ago
Edited 3 years ago

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.

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?

2 answers

Log in to vote
0
Answered by
Accoast 43
3 years ago

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)
Ad
Log in to vote
0
Answered by
KingDomas 153
3 years ago
Edited 3 years ago

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.