Hello
Im trying to make this thing that detects if a player is holding their passport and doesn’t have contraband (MG-BU, AR-BU, PS-BU) When the player is holding their passport and doesnt have contraband, its valid, but if they aren’t holding the passport or they have contraband it is invalid but even when Im holding the passport and don’t have contraband it still says invalid.
Please help if you can!
local tweenService = game:GetService("TweenService")
local tweenInfo1 = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local tweenInfo2 = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
local tween1 = tweenService:Create(workspace.DoorToCity, tweenInfo1, { Position = Vector3.new(-67.781, 34.003, 109.63) })
local tween2 = tweenService:Create(workspace.DoorToCity, tweenInfo2, { Position = Vector3.new(-67.781, 12.003, 109.63) })
local tween3 = tweenService:Create(workspace.DoorToScanner, tweenInfo1, { Position = Vector3.new(-38.317, 34.003, 109.63) })
local tween4 = tweenService:Create(workspace.DoorToScanner, tweenInfo2, { Position = Vector3.new(-38.317, 12.003, 109.63) })
script.Parent.Triggered:Connect(function(player)
local backpack = player:FindFirstChild("Backpack")
local char = player.Character
if backpack:FindFirstChild("MG-BU") or backpack:FindFirstChild("AR-BU") or backpack:FindFirstChild("PS-BU") then
script.Parent.Parent.BrickColor = BrickColor.new("Really red")
game.ReplicatedStorage.PassportInvalid:FireClient(player)
wait(2)
char.PrimaryPart.CFrame = workspace.InvalidTeleport.CFrame
wait(1)
tween3:Play()
script.Parent.Parent.BrickColor = BrickColor.new("Medium stone grey")
elseif char:FindFirstChild("Passport") then
script.Parent.Parent.BrickColor = BrickColor.new("Lime green")
game.ReplicatedStorage.PassportValid:FireClient(player)
tween1:Play()
wait(3)
tween2:Play()
wait(2)
tween3:Play()
script.Parent.Parent.BrickColor = BrickColor.new("Medium stone grey")
else
script.Parent.Parent.BrickColor = BrickColor.new("Really red")
game.ReplicatedStorage.PassportInvalid:FireClient(player)
wait(2)
char.PrimaryPart.CFrame = workspace.InvalidTeleport.CFrame
wait(1)
tween3:Play()
script.Parent.Parent.BrickColor = BrickColor.new("Medium stone grey")
end
end)