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

How do I make this only run after it checks if player has certain rank in group?

Here, I got this script and I want it to only run for a specific rank and up in a group, if anyone can do this it will be appreciated.

local Opened = script.Parent.Opened

function Open(Part, Type)
	if Opened.Value == false then
		if game.Players:FindFirstChild(Part.Parent.Name) or game.Players:FindFirstChild(Part.Parent.Parent.Name) then
			Opened.Value = true
			for i = 0.1,5.4, 0.1 do
				script.Parent.DoorLeft.CFrame = script.Parent.DoorLeft.CFrame * CFrame.new(0.1,0,0)
				script.Parent.DoorRight.CFrame = script.Parent.DoorRight.CFrame * CFrame.new(-0.1,0,0)
				wait()
			end
			wait(script.Parent.WaitTime.Value)
			for i = 0.1,5.4, 0.1 do
				script.Parent.DoorLeft.CFrame = script.Parent.DoorLeft.CFrame * CFrame.new(-0.1,0,0)
				script.Parent.DoorRight.CFrame = script.Parent.DoorRight.CFrame * CFrame.new(0.1,0,0)
				wait()
			end
			Opened.Value = false
		end
	end
end

script.Parent.Field1.Touched:connect(Open)
script.Parent.Field2.Touched:connect(Open)

1 answer

Try getting the player from the character then try to use :GetRankInGroup or :GetRoleInGroup and if its the current rank then open the door. example below :

local player = game.Players:GetPlayerFromCharacter()
local groupid = 123456 --put group id
local rank = 1 --change this however you want "255" is the owner "1" is a member
local checkrank = player:GetRankInGroup(groupid)
function Touched()
if checkrank == 255 or checkrank +200 then
--insert script here--
end
end
script.Parent.Touched:Connect(Touched)

1 comment

0

hope this helps you

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