I am attempting to script a door that lets only ranks above 20 in that group through.
ID=2606952
Part=script.Parent
script.Parent.Touched:connect(onTouched)
function onTouched(hit)
if Part.Parent:FindFirstChild("Humanoid") then
local Player=game.Players:GetPlayerFromCharacter(Part.Parent)
if Player:IsInGroup(ID) then
if Player:GroupRank(20) then
script.Parent.CanCollide=false
wait(0.1)
script.Parent.CanCollide=true
end
end
end
end
It won't let through the rank 20. Also for letting every rank above 20 through what do I do? Do I have to list every rank above 20? Or can I tell it to allow every rank value above 20?
My original is terrible, but with help from drew1017 and KoreanBBQ I got this -
ID=2606952
part=script.Parent
rank=player:GetRankInGroup(ID)
part.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
player=game.Players.GetPlayerFromCharacter(hit.Parent)
if rank > 19 then
part.CanCollide=false
wait(1)
part.CanCollide=true
end
end
end)
but neither of theirs or this one works. What am I doing wrong? e.e

3 comments
Thank you so much, but when I touched the Part nothing happened... e.e
Maybe change the CanCollide time to like 10 seconds and change the transparency to make it noticable.
I did change the wait time and made it change the transparency to 0.5 and back to 0, but nothing happens when I touch the brick. Is the script not firing, maybe? I know I am definitely in the group and far above rank 20.