RankDoor Script - StarterPlayerScripts

Hello, developers. I am trying to create a script that is client sided for my game. I would like this script to allow ranks 4+ in the group 7333487 to delete a certain block on their client. This is called a rankdoor script to round this up.

local block = PATH_TO_BLOCK_HERE

local group_id = GROUP_ID_HERE

local rank_needed = 4 

if game.Players.LocalPlayer:GetRoleInGroup(group_id) >= rank_needed then
	local click_detector = Instance.new("ClickDetector")
	click_detector.MouseClick:Connect(function()
		block:Destroy()
	end)
	click_detector.Parent = block
end
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local block = game.Workspace.Part --Change where the block is

if player:IsInGroup(7333487) then
	if (player:GetRoleInGroup(7333487)) == "4+" then
		local clickdetector = Instance.new("ClickDetector", block)
		clickdetector.MouseClick:Connect(function()
			block:Destroy()
		end)
	end
end

is there any way of making it so it deletes the block when the user joins the game if they pass the requirements

yeah,

local block = PATH_TO_BLOCK_HERE

local group_id = GROUP_ID_HERE

local rank_needed = 4 

if game.Players.LocalPlayer:GetRoleInGroup(group_id) >= rank_needed then
	block:Destroy()
end

is that script clientsided? [CHARACTER LIMIT]

yes just put in a localscript inside StarterPlayerScripts

I think you meant to type, GetRankInGroup(group_id).

This script should work:

local player = game.Players.LocalPlayer
local part = PATH_TO_PART
local group_id = GROUP_ID
local min_rank = 4 

if player:GetRankInGroup(group_id) >= min_rank then
	part:Destroy()
end

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local block = game.Workspace.Part

if player:IsInGroup(7333487) then
if (player:GetRankInGroup(7333487)) >= 4 then
local clickdetector = Instance.new(“ClickDetector”, block)
clickdetector.MouseClick:Connect(function()
block:Destroy()
end)
end
end