I’m trying to make a part that does nothing to people with the gamepass or the minimum group rank. If they don’t meet those requirements, they get teleported to the NotEntertainerTP part.
But it does nothing to regular members. Anyone able to help? Full script below.
local rank = 252
local groupID = 9963063
local MarketPlaceService = game:GetService("MarketplaceService")
script.Parent.Touched:connect(function(hit)
local EntertainerPass = MarketPlaceService.UserOwnsGamePassAsync(game.Players:GetPlayerFromCharacter(hit.Parent).UserId, 15793790)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) >= rank or EntertainerPass then
print("Player is entertainer.")
else
local target = game.Workspace.NotEntertainerTP.CFrame
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
player.Character.HumanoidRootPart.CFrame = target
end
end
print("Player is not entertainer.")
end
end
end)
What I don’t understand is why you’re looping through all the players after touching the part and you don’t have the permissions when only the player who touched it getss teleported.
Maybe try
local target = game.Workspace.NotEntertainerTP.CFrame
hit.Parent.HumanoidRootPart.CFrame = target
print("Player is not entertainer.")
Hey! You might want to check out check out PhysicsService. It’s a cools service that allows you to edit the collision behavior of collision group with other collision groups! So for you I’d do it like this:
Create Collision group 1
Make collision group 1 not collide with default group
Create collision group 2
Make collision group 2 not collide with collision group 1 but collide with the default collision group
If player meets the requirements to go through the door then add them to collision group 2. Otherwise don’t do anything to them.