Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

If someone bought my V.I.P. T-shirt, how would I make a V.I.P. Door work?

3 answers

✓ Accepted answer

Here is the script i made :

-- Recommended: Place this in the VIP Door
----------------------------------------------------------------------- 
PassOrShirtID = 000000000 -- Change this to your asset/shirt/badge/pass ID
Door = script.Parent -- Change this to the door (if needed)
OpenTime = 1 -- Change how long you want the door open
Prompt = true -- true = if the player doesn't have the item, prompt a screen to let them buy it. false = kill the player.
-----------------------------------------------------------------------
-- Made by Maronics --


--Do not touch below--
Serv = game:GetService("BadgeService")
MServ = game:GetService("MarketplaceService")
if not _G.Players then
	_G.Players = {
		[PassOrShirtID] = {};
	}
	print("Players Created")
elseif not _G.Players[PassOrShirtID] then
	_G.Players[PassOrShirtID] = {};
	print("Players.Pass created")
end

Table = _G.Players[PassOrShirtID]

function CheckPlayer(player2)
	for i = 1,#Table do
		if Table[i] == player2 then
			return true
		end
	end
	return false
end

Door.Touched:connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if Serv:UserHasBadge(player.userId,PassOrShirtID) or CheckPlayer(player) then
			Door.CanCollide = false; Door.Transparency = 0.5;
			wait(OpenTime);
			Door.CanCollide = true; Door.Transparency = 0;
		else
			if Prompt then -- Maronics
				MServ:PromptPurchase(player,PassOrShirtID)
				h = player.Character:FindFirstChild("Humanoid")
				if h then h.WalkSpeed = 0 end
				local con;
				con = MServ.PromptPurchaseFinished:connect(function(ply,asset,purch)
					if ply == player and asset == PassOrShirtID then
						con:disconnect()
						if purch then
							if h then h.WalkSpeed = 16 end
							table.insert(Table,player)
						else
							player.Character:BreakJoints()
						end
					end	
				end)
			else
				player.Character:BreakJoints()
			end
		end
	end
end)




















-- Made by Maronics

Hope it helped :)

Make a gamepass, then go to your inventory and configure the gamepass from there, sell it. Once your done look at the number id on the top of the page at the link of your game pass, examine your V.I.P door in roblox studio, you will find the id part inside it, view properties and enter the number id of the gamepass there. It's that simple. Hope I helped.

Suggestion for above, you can make the door teleport the player, so hackers don't hack into it you can add this instead of CanCollide and Transparency:

GoTo = 0,0,0 -- Set the 0,0,0 to the position you want the player to teleport.
part.Parent:MoveTo(GoTo) -- This might not work , I haven't tested this.

1 comment

0

Oh and comment the error on this answer and i'll see if I can fix it.

This discussion is preserved as it was. New answers, comments, and votes are closed.