Still have questions? Join our Discord server and get real time help.
0

# How do I make a gamepass and/or group door?

I want to make a part that allows gamepass owners or a certain rank to be able to go through it, but when I scripted it I get some errors, I'm an intermediate scripter.

Here is the script I made:

script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if marketplace:UserOwnsGamePassAsync(plr.UserId, gamepassidhere) or
plr:GetRankInGroup(groupid) >= 0 then
script.Parent.CanCollide = false
wait(2)
script.Parent.CanCollide = true
end
end
end)


0
iivSnooxy 216
13 days ago

Hii, here’s the Group Rank Door script!

--PUT THIS SCRIPT UNDER STARTERGUI!!!--

local Player = game.Players.LocalPlayer
local doorPart = game.Workspace.Door.Door
local groupId = --GROUPIDHERE
local minimumRank = 2

if Player:GetRankInGroup(groupId) >= minimumRank then
print("Player is at or above minimum rank")
doorPart.CanCollide = false
else
print("Player is below minimum rank")
doorPart.CanCollide = true
end

0
changing it in server will change it for everyone kkfilms_1 68 — 13d
0
you probably shouldn't give entire scripts. Qub_lex 139 — 13d
0
Also, there's no need to put it in StarterGui. Qub_lex 139 — 13d
0
I’m not a good scripter yet ok? Lol iivSnooxy 216 — 13d
0
Edited 13 days ago

I suggest using a RemoteEvent in Replicated Storage

ServerScript:

script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if marketplace:UserOwnsGamePassAsync(plr.UserId, gamepassidhere) or
if plr:GetRankInGroup(groupid) >= 0 then
game.ReplicatedStorage.RemoteEvent:FireClient(plr)
end
end
end)



Local Script in StarterPlayerScripts:

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
local door = workspace:FindFirstChild(“door”,true) —Change this to the name of the door
door.CanColliide = false
wait(2)
door.CanCollide = true
end)


If it’s fine, can you elaborate on the errors so i can adjust the script accordingly?

0
For ServerScript, lines 5th has a error with the "if" and for Local Script, it says "OnServerEvent can only be used on the server"  RealAlphaswordYT2 -9 — 13d
0
sorry i changed it kkfilms_1 68 — 13d