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

Make a door that more than one team can walk through?

Asked by 5 years ago
Edited 5 years ago

I've been trying several methods but they seem not to be working, the door only opens for the Maroon team, and not the Bright red team. Whatever is listed first will open the door for that specific team. But in this case, I want more than one team to walk through the door instead of just one team. Responses are appreciated. [The AntiHack and fancy stuff is not necessary, a simple script would do just fine too.]

01TeamColor="Maroon" --the team color allowed though
02Time=2   -- time to keep door opened
03AntiHack=1 --This is the mode it will do to intruders who touch the door   0= mostly nothing if they sneak, 1= pushes em back and sits em ^_^, 2=Kills em on touch....
04ColorDoor=false --whether it colors the door the team color you disignated
05----------------------------------------code------------------------------------------------------------------------------
06Color=BrickColor.new(TeamColor)
07on=false
08s=script.Parent
09ss=script.Parent:clone()
10s.BrickColor=Color
11function Check(hit) if on then return end
12if hit==nil then return end
13local player=game.Players:FindFirstChild(hit.Parent.Name)
14if player==nil then return end
15on=true
View all 38 lines...
0
I posted a answer more Easy to do, you can modify if you like. i explained all and its easy yHasteeD 1819 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

My idea.

Alright so I think I know what you can do as if I remember correctly and correct me if i'm wrong but you can add more than one value to a NameValue such as TeamColor so I'm taking a guess at this to see if this works..

What I did

All I really did was just add "Teal" into the value of TeamColor, now of course you'll have to change that to a color of what you have. If that doesn't work, try changing the or to an ,

Here you go, my tiny extra fix.

01TeamColor = "Maroon" or "Teal" --the team color allowed though
02Time = 2   -- time to keep door opened
03AntiHack = 1 --This is the mode it will do to intruders who touch the door   0= mostly nothing if they sneak, 1= pushes em back and sits em ^_^, 2=Kills em on touch....
04ColorDoor = false --whether it colors the door the team color you disignated
05----------------------------------------code------------------------------------------------------------------------------
06Color=BrickColor.new(TeamColor)
07on=false
08s=script.Parent
09ss=script.Parent:clone()
10s.BrickColor=Color
11function Check(hit) if on then return end
12if hit==nil then return end
13local player=game.Players:FindFirstChild(hit.Parent.Name)
14if player==nil then return end
15on=true
View all 38 lines...
Ad
Log in to vote
0
Answered by
yHasteeD 1819 Moderation Voter
5 years ago

Well, you can make it checking the name in a dictionary tables, like a whitelist:

1local List = {
2    ["Maroon"] = true;
3    -- ...
4}

Then you need to check if List[tostring(Player.TeamColor)] then on the Touch Event, if its true, then you can make your functional, if not, kill the player. Example:

01--> Services
02local Players = game:GetService("Players")
03 
04--> Variables
05local Part = script.Parent
06local Debounces = {} --> Make a Player Debounce, for the player not touch soo much times in like 1 second.
07local List = {
08    ["Maroon"] = true;
09}
10 
11Part.Touched:Connect(function(Hit)
12    local Humanoid = Hit.Parent:FindFirstChild("Humanoid") --> Try to find Humanoid
13    local Player = Humanoid and Players:GetPlayerFromCharacter(Hit.Parent) --> If Humanoid exists get player, else nil.
14    if  Player then --> Check if the player exists
15        if List[Player.TeamColor] then
View all 32 lines...

Hope it helped!

Answer this question