Hey guys! Welcome to my second video! In this tutorial im gonna teach you how to make a door that only lets you pass through if you have VIP!
Here is the script if you dont wanna copy it from the video:
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local Door = script.Parent.Door
local TeleportPart = script.Parent.TeleportPart
local GamepassId = 1693911299
Door.Touched:Connect(function(hit)
local plr = Players:GetPlayerFromCharacter(hit.Parent)
if not plr then
return
end
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, GamepassId) then
Door.CanCollide = false
Door.Transparency = 0.7
task.wait(1)
Door.CanCollide = true
Door.Transparency = 0
else
MarketplaceService:PromptGamePassPurchase(plr, GamepassId)
hit.Parent.HumanoidRootPart.CFrame = TeleportPart.CFrame + Vector3.new(0, 3, 0)
end
end)