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

How do you allow people through Door restrictions?

Asked by 9 years ago

I tried different codes GetChildren, GetPlayers, IsInGroup, game.Players.LocalPlayers and it just wouldn't allow anyone to go through the door. I just want TeamColor "Really Blue" also known as Team "ct" to get through the door

01local leaderboard = script.Parent.Parent:WaitForChild('leaderboard')
02local door = script.Parent
03 
04function open()
05    door.CanCollide = false
06    for transparency = 0, 1, .1 do
07        door.Transparency = transparency
08        wait(.1)
09    end
10end
11 
12function close()
13    for transparency = 1, 0, -.1 do
14        door.Transparency = transparency
15        wait(.1)
View all 43 lines...

Oh and if you are going to reply don't reply to me about "IsInGroup".

0
Also it just loads the character... No errors found hardhitsniper 30 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

This is what's wrong:

1game.Players:GetChildren().TeamColor == 'Really blue'

It is wrong because:

1. You did not specify which child of game.Players:GetChildren() to index.

2. Team Color values are not strings, they are BrickColor.new("Color name")

This is a different, simpler version of your function, less fancy, but just as effective:

1door.Touched:connect(function(hit)
2    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
3    if player then
4        if player.TeamColor == BrickColor.new("Really blue") then
5            open()
6            delay(4,close)
7        end
8    end
9end)
Ad

Answer this question