I want the ability to bind a script to multiple groups in select ranks on one door so I wouldn’t have to be complicated and have this done in two completely separate doors.
The issue I’m having so far right now is that when I bind it to a single group, works completely fine, but if I attempt at adding another group + rank using the else if
statement, it doesn’t seem to work.
I looked around the forums and YouTube for a bit and seems like no one has came up with this issue before. I’m not a scripter and requested someone else to do it for me, however their script didn’t work.
This is the script:
local rank = 30 -- The rank the player will need to get through (out of 255)
local groupID = 8610690 -- The group ID the player must be in
local Player = game.Players.LocalPlayer
script.Parent.Touched:connect(function(hit)
if not hit:IsDescendantOf(Player.Character) then
return
end
if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then
if (game.Players[hit.Parent.Name]:IsInGroup(groupID) and game.Players[hit.Parent.Name]:GetRankInGroup(groupID) >= rank) then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
wait(0.5)
script.Parent.CanCollide = true
script.Parent.Transparency = 1
elseif (game.Players[hit.Parent.Name]:IsInGroup(11549657) and game.Players[hit.Parent.Name]:GetRankInGroup(11549657) >= 3) then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
wait(0.5)
script.Parent.CanCollide = true
script.Parent.Transparency = 1
else
script.Parent.CanCollide = true
end
end
end)
I didn’t receive any errors from the script so I’m really not sure what could be the issue here. How would I fix this?