Padlock System for Military Group

I need a script to make a padlock system in my military roblox game but im not sure how to do it, all i need is for someone to say a command such as “/lock 1,2,3,4,5,6,7,8,9 or all”, i also need it so only a certain rank in my group can use so command someone please help!

We have trief multiple versions, however it did not work and I need urgent assistance with this topic.

5 Likes

u can do something like this:

local groupid = 123456789
local minrank = 1

lock = function(v)
	for i,p in pairs(v:GetChildren()) do
		p.Transparency = .75
		p.CanCollide = true
	end
end

unlock = function(v)
	for i,p in pairs(v:GetChildren()) do
		p.Transparency = 1
		p.CanCollide = false
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if plr:GetRankInGroup(groupid) >= minrank then
			for _,v in pairs(game.Workspace.Pads:GetChildren()) do
				if msg == ".lock pad "..v.Name then
					lock(v)
				elseif msg == ".lock pad all" then
					lock(v)
				elseif msg == ".unlock pad "..v.Name then
					unlock(v)
				elseif msg == ".unlock pad all" then
					unlock(v)
				end
			end
		end
	end)
end)