Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make this work for a groups high ranks instead or specific people?

Asked by 10 years ago

I tried but cant figure it out!

admins = {""}

function isAdmin(name) 
for i,v in pairs(admins) do 
if name:lower() == v:lower() then return true end
end 
return false 
end 

local door=script.Parent 
game.Players.PlayerAdded:connect(function(p) 
if isAdmin(p.Name) then 
p.Chatted:connect(function(msg) 
if msg=="Open lobby" then
door.Transparency=.1
wait (.1)
door.Transparency=.2
wait (.1)
door.Transparency=.3
wait (.1)
door.Transparency=.4
wait (.1)
door.Transparency=.5
wait (.1)
door.Transparency=.6
wait (.1)
door.Transparency=.7
wait (.1)
door.Transparency=.8
wait (.1)
door.Transparency=.9
wait (.1)
door.Transparency=1
door.CanCollide=false 
elseif msg=="Close lobby" then
door.CanCollide=true
door.Transparency=.9
wait (.1)
door.Transparency=.8
wait (.1)
door.Transparency=.7
wait (.1)
door.Transparency=.6
wait (.1)
door.Transparency=.5
wait (.1)
door.Transparency=.4
wait (.1)
door.Transparency=.3
wait (.1)
door.Transparency=.2
wait (.1)
door.Transparency=.1
end 
end) 
end 
end)

1 answer

Log in to vote
0
Answered by 10 years ago

Not tested but should work.

GroupId = 0 --Group Id goes here
Rank = plr:GetRankInGroup(GroupId) --Nothing needs to be edited here

local door=script.Parent 
game.Players.PlayerAdded:connect(function(p) 
if Rank >= Rank number goes here then --Type the rank number of the lowest rank you want to enter
p.Chatted:connect(function(msg) 
if msg=="Open lobby" then
door.Transparency=.1
wait (.1)
door.Transparency=.2
wait (.1)
door.Transparency=.3
wait (.1)
door.Transparency=.4
wait (.1)
door.Transparency=.5
wait (.1)
door.Transparency=.6
wait (.1)
door.Transparency=.7
wait (.1)
door.Transparency=.8
wait (.1)
door.Transparency=.9
wait (.1)
door.Transparency=1
door.CanCollide=false 
elseif msg=="Close lobby" then
door.CanCollide=true
door.Transparency=.9
wait (.1)
door.Transparency=.8
wait (.1)
door.Transparency=.7
wait (.1)
door.Transparency=.6
wait (.1)
door.Transparency=.5
wait (.1)
door.Transparency=.4
wait (.1)
door.Transparency=.3
wait (.1)
door.Transparency=.2
wait (.1)
door.Transparency=.1
end 
end) 
end 
end)

0
So this will let only the HR's open the door? snoppyploptart 59 — 10y
0
Yes Alpha_Toon 57 — 10y
Ad

Answer this question