local gamePassService = game:GetService("GamePassService")
local closed_position = script.Parent.Position
local open_position = Vector3.new(434.199, 118.508, -78.223)
local passid = script.Parent.Gamepass:WaitForChild("Gamepass").Value
local opening = false
local closing = false
local function slideDoor(slideTime, startPos, endPos)
local movingOpen = opening
local loopBroken = false
local slideInterval = (endPos - startPos) / (30 * slideTime)
for i = 1, (30 * slideTime) do
if opening ~= movingOpen then
loopBroken = true
break
end
wait(1 / 30)
script.Parent.Position = script.Parent.Pos + slideInterval
end
if not loopBroken then
opening = false
closing = false
script.Parent.Position = endPos
end
end
--Test ok
while wait() do
local playersCloseBy = false
for i, plr in pairs(game.Players:GetPlayers()) do
if gamePassService:PlayerHasPass(plr, passid) and plr.Character then
print("Ye boi")
local distance = (plr.Character.Torso.Position - part_position).magnitude
if distance < 5 and not opening and script.Parent.Position ~= open_position then
playersCloseBy = true
end
end
end
if not playersCloseBy and not closing and script.Parent.Position ~= closed_Position then --Closes door
opening = false
closing = true
slideDoor(3, script.Parent.Position, closed_position)
elseif playersCloseBy and not opening and script.Parent.Position ~= open_Position then --Opens door
opening = true
closing = false
slideDoor(3, script.Parent.Position, open_position)
end
end
22:08:31.411 - Infinite yield possible on 'Workspace.VIP.P2.Gamepass:WaitForChild("Gamepass")' Please help.

2 comments
Probably because there isn't anything named "Gamepass" under Gamepass.
That is a warning you see any time you use :WaitForChild() without its second optional timout argument. It's warning you that if it never finds the child, it will yield forever and never execute the rest of the script.