So I’m looking on how to make it so that if you’re a member of premium, you’ll be able to walk through a specific part, but if you’re not, you won’t be able to walk through it and it will prompt you to buy it.
Any help would be really appriciated!
So I’m looking on how to make it so that if you’re a member of premium, you’ll be able to walk through a specific part, but if you’re not, you won’t be able to walk through it and it will prompt you to buy it.
Any help would be really appriciated!
You can do this with a local script. When they join, on the client, check if they own the gamepass, then if they do then you can set the door to Cancollide Off with the local script.
I meant if they’re a member of Roblox Premium.
There should be a property of a player called MembershipType or something.
You can use:
player.MembershipType
And check if they’re premium using the Enum:
Enum.MembershipType.Premium
Here’s the documentation:
(It covers prompting players to purchase premium and how to check if a player has premium)
Take my script i made before cause it’s an easy thing to make this script will make you go trough the door when you have premium
local door = script.Parent
local mps = game:GetService("MarketplaceService")
local isOpen = false
door.Touched:Connect(function(touch)
local char = touch.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if not plr then return end
if plr.MembershipType == Enum.MembershipType.Premium then
if isOpen then return end
isOpen = true
door.Transparency = 1
door.CanCollide = false
wait(2)
door.Transparency = 0
door.CanCollide = true
isOpen = false
else
mps:PromptPremiumPurchase(plr)
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr.MembershipType = Enum.MembershipTyep.Premium then
-- your code
end
end
end)
Also, you can make it client sided so that the door only opens for the player, just use game.Players.LocalPlayer
Is there any way you could make it just let the player who have premium through in stead of opening the door for everyone?
ye do the script in a local script not a normal script that needs to work if i’m right.
Use a local script to make it client sided, that way, it only opens for them.
So I just add a LocalScript into the part that is in Workspace?
Put this in a LocalScript. The only problem is that a hacker could get through the door without Premium, but you could implement checks to see if they glitched through.
local door = ---
local plr = game.Players.LocalPlayer
if plr.MembershipType == Enum.MembershipType.Premium then
door.CanCollide = false
end
yes that’s what you need to do and also do the script inside of it.
Okay and this makes it so that if a player doesn’t own premium it prompts him right?
yes it will open the door if they have premium.
it will only open for one player not everyone i hope.
But if a player doesn’t have premium, do they get prompted?
no it doesn’t open if they don’t own it.
Yes they will be prompted if they don’t have it, else it will open only for them.
Do they get prompted though if they don’t own it?
yes they get prompted if they don’t own it.
but that doesn’t really care if it works than it works but try it on 2 roblox accounts to test it look for an account with no premium and 1 acc with premium so you can test it.