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

How do I get this script to function with multiple different teams?

Asked by 3 years ago

This script makes it so if you are on a certain team, the proximity prompt to activate a robbery does nothing, and if you are on a different team it starts the bank robbery. How do I get it so that you can start the robbery on multiple teams?

local frame = script.Parent
local openSound = script.Parent.DoorOpen
local closeSound = script.Parent.DoorClose
local proximityprompt = frame.PromptAttachment.ProximityPrompt
local model = script.Parent.Parent
local frameClose = model:WaitForChild("DoorClosed")
local frameOpen = model:WaitForChild("DoorOpened")
local opened = model:WaitForChild("Opened")
local tweenService = game:GetService("TweenService")
local alarm = script.Parent.Parent.AlarmPart.Alarm
local alarm2 =  script.Parent.Parent.AlarmPart.Alarm2
local BadGuys = game:GetService("Teams")["Team2"]
local BadGuys2 = game:GetService("Teams")["Team3"]
local GoodGuys = game:GetService("Teams")["Team1"]
local deniedsound = script.Parent.Denied

local debounce = true
proximityprompt.Triggered:Connect(function(player)
    if debounce == true then
        debounce = false
        if player.Team == BadGuys then
            print("Robbery started.")
               openSound:Play()
               alarm:Play()
               alarm2:Play()
               tweenService:Create(frame,TweenInfo.new(.35),{CFrame = 
                       frameOpen.CFrame}):Play()
               proximityprompt.Enabled = false
               wait(45)
               closeSound:Play()
               alarm:Stop()
               alarm2:Stop()
               tweenService:Create(frame,TweenInfo.new(.35),{CFrame = 
                       frameClose.CFrame}):Play()
               wait(120)
               proximityprompt.Enabled = true
        elseif player.Team == GoodGuys then
                deniedsound:Play()
                print("You're on the wrong team!")
                debounce = true
            end
        end
        end)

1 answer

Log in to vote
0
Answered by
CDXKIE 130
3 years ago

This is rather simple. You have to simply and an or after checking something. Like this:

if player.Team == BadGuys or player.Team == (INSERT ANOTHER TEAM HERE) then
    --insert cdoe here
end

Or, if you want to have every team except for good guys be able to rob, you could do:

if not player.Team == goodGuys then
    --insert code here
end
Ad

Answer this question