Hello !
I am the head dev. of world at war community. We’re currently facing several problems with the game pass doors I modified. You have to know that when we own a game pass, you can enter the room. If you dont, it kills you.
The problem is here : Doors work with several game pass ID (3 different Game passes) each, and sometimes(/always ?) kills players that own one of these pass. I dont know where is the problem exactly. Here is the code :
-- -----------------------------------------------------------------------------------------------
local MS = game:GetService("MarketplaceService")
local Gamepass = 7988902 -- The ID of the Gamepass.
local Gamepass2 = 8439939 -- The ID of the 2nd Gamepass.
local Gamepass3 = 8440060 -- The ID of the 3rd Gamepass.
local OpenTime = 1 -- The time the door is open for.
local OpenTrans = 0.5 -- The transparency of the door when it is open.
local CloseTrans = 0 -- The transparency of the door when it is closed.
local BuyGUI = false -- Set to false to stop the BuyGUI appearing.
local KillOnTouch = true -- Set to false to stop players being killed when they touch it.
local Whitelist = {
1 --ROBLOX
} -- USERID || People that can open the door without owning the badge.
-----------------------------------------------------------------------------------------------
local Door = script.Parent -- The door
-----------------------------------------------------------------------------------------------
function CheckWhitelist(v)
for i = 1, #Whitelist do
if v == Whitelist[i] then
return true
end
end
return false
end
Door.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if Gamepass <= 0 then return nil end
if MS:UserOwnsGamePassAsync(plr.UserId, Gamepass) or MS:UserOwnsGamePassAsync(plr.UserId, Gamepass2) or MS:UserOwnsGamePassAsync(plr.UserId, Gamepass3) or CheckWhitelist(plr.UserId) then
Door.CanCollide, Door.Transparency = false, OpenTrans
wait(OpenTime)
Door.CanCollide, Door.Transparency = true, CloseTrans
else
Door.CanCollide, Door.Transparency = true, CloseTrans
if BuyGUI == true then
MS:PromptGamePassPurchase(plr, Gamepass)
end
if KillOnTouch == true then
plr.Character.Humanoid.Health = 0
end
end
end
end)
I’ll be glad if you can help me about this. I want to make all the game passes working together, in one door. Thanks for replying !