Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Team changer script checking rank in group not working?

I am making a team changer script which checks if you're in a group and then checks to see what rank you are, If you are the correct rank then the script continues.

However I can't seem to understand why this script isn't working. It is placed inside a GUI Text Button. Please help.

local player = script.Parent.Parent.Parent.Parent.Parent

local debounce = true
script.Parent.MouseButton1Click:Connect(function()
	if player:IsInGroup(1230923) == 10 and debounce == true then
	player.Team = game.Teams.Cabinet
	debounce = false
	player.Character.Humanoid.Health = 0
	else
		print("Not in group!")
	wait(3)
	debounce = true
	end
end)

2 answers

PlayerIsInGroup does not return the rank, only a boolean (true/false) depending on if they're a part of the group or not. What you wanna use is GetRankInGroup.

You need to use GetRankInGroup to get players rank

local player = script.Parent.Parent.Parent.Parent.Parent

local debounce = true
script.Parent.MouseButton1Click:Connect(function()
    if player:GetRankInGroup(1230923) == 10 and debounce == true then
    player.Team = game.Teams.Cabinet
    debounce = false
    player.Character.Humanoid.Health = 0
    else
        print("Not in group!")
    wait(3)
    debounce = true
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.