Keep getting IsInGroup a nill value heres the code, are you able to tell what i'm doing wrong? I was able to get it to work with hit but the type of game i'm making requires to it be click...
``` local rank = 1
local groupID = 4857556
clicked = false
waited = true
function onClicked(Clicker)
print(Clicker.Name)
if (Clicker.Name:IsInGroup(groupID) and Clicker.Name:GetRankInGroup(rank) >= rank) then
if clicked == true and waited == true
then
script.Parent.Transparency = 0
script.Parent.CanCollide = true
clicked = false
print("Clicked Close")
wait(0.1)
waited = false
end
if clicked == false and waited == true
then
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
clicked = true
end
wait(0.1)
waited = true
end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
You are doing Clicker.Name
, which is a string of course.
It would obviously error to do a_string:IsInGroup()
. You would just need to change that to Clicked, which is the "Instance" that clicked.
So the right thing is Instance:IsInGroup
And that's also for the :GetRankInGroup
Another thing, in the :GetRankInGroup
bit, your putting the rank as the paramater, while the paramater for that function should be the groupId so fix that.
local rank = 1 local groupID = 4857556 clicked = false waited = true function onClicked(Clicker) print(Clicker.Name) if (Clicker:IsInGroup(groupID) and Clicker:GetRankInGroup(groupID) >= rank) then if clicked == true and waited == true then script.Parent.Transparency = 0 script.Parent.CanCollide = true clicked = false print("Clicked Close") wait(0.1) waited = false end if clicked == false and waited == true then script.Parent.Transparency = 0.5 script.Parent.CanCollide = false clicked = true end wait(0.1) waited = true end end script.Parent.ClickDetector.MouseClick:connect(onClicked)