Team changer script

Hello devforum! I have this script but I want it ranked locked. Is there away to do this?

The issue is I have no clue how to do it.

I have tryed to look this up and have found nothing.

The script is here:

script.Parent.MouseButton1Click:Connect(function()

script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Institutional white”)

wait(0.5)

script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0

end)

1 Like

https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup

You should at least do a bit of searching before creating a thread.

So I read the post and I understand group ids and how they work but not sure how to make a scirpt for it, I dont know much about sripting.

group ranks go from 0-255 if u use getrankingroup

I know that, I’m just how to make it a script

just do:

if player:GetRankInGroup(groupid) == 255 then – will be the owner since 255 is the highest

so like this?

script.Parent.MouseButton1Click:Connect(function()getrankingroup(groupid) == 255

script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Institutional white”)

wait(0.5)

script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0

end)

(ik I have to replace group id and rank id)

check it after the button got clicked

script.Parent.MouseButton1Click:Connect(function()
	if game:GetService("Players").LocalPlayer:GetRankInGroup(groupid) == 255 then
		script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Institutional white")

		wait(0.5)

		script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
	end
end)
1 Like