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

How do you make a team only door that has something to do with the team name? [closed]

Asked by 5 years ago

I have no idea how to script, so can you help me?

0
'Scripting Helpers is not a request site! Your post will be removed if it does not comply with our rules. Please see this help article for more information.' Please report this by clicking 'Moderation' and don't answer. Sonnenroboter 336 — 5y

Closed as Not Constructive by Sonnenroboter, zblox164, SuperSamyGamer, Psudar, and theking48989987

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?

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
5 years ago
Edited 5 years ago

Seems you need a Touched event.

local Door = workspace.Door -- define the door
local debounce = false -- make sure to have a debounce

Players = game:GetService('Players') - we'll be needing this service



Door.Touched:Connect(function(otherPart)
    local Player = Players:GetPlayerFromCharacter(otherpart.Parent)
    if Player then
        if Player.Team == game.Teams['TeamNameHere'] and debounce == false then -- check team and debounce
            debounce = true
            Door.Transparency =.5
            Door.CanCollide = false
            wait(.5) -- how long before the door goes back to normal
            Door.Transparency = 0
            Door.CanCollide = true
            debounce  = false
        end
    end
end)

Make sure to properly define the door to make sure this works.

Ad