Rank and above to change team

Hello I have this script from my last post but instead of it just becoming one rank I want it to be one rank and above. How do I do this?

I keep geting errors when I try to do this

I have tryed to code this in but it has not worked. Here is the script.

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

assuming you mean something like ranks 254 and 255 istead of only 255, you could use >= 254 instead of == 255

2 Likes

Seems to not be working, i’m not sure why. When I click to change my team it wont let me.

script.Parent.MouseButton1Click:Connect(function()
if game:GetService(“Players”).LocalPlayer:GetRankInGroup(13824371) >- 3 then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Br. Br. yellowish orange”)

	wait(0.5)

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

end)

1 Like
script.Parent.MouseButton1Click:Connect(function()
    if game:GetService("Players").LocalPlayer:GetRankInGroup(13824371) >= 3 then
        script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Br. Br. yellowish orange”)
	    task.wait(0.5)
	    script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
    end
end)

I changed >- to >=, but I still recommend you to change the player’s health and team on server side. Client sided is never to be trusted and the server is always secure with true information.

1 Like

Does not seemed to be working and I have no clue why.

What is the type of script you’re using?

LocalScript or Script?

The script I am using is a script.

this should be erroring because you wrote >- instead of >=
the code @NoobiDerpieDev gave you shouldve given errors for trying to use LocalPlayer

you should use the output because it helps you and anyone helping narrow down the issue

I mean its not a local script, should it be? I used a script and the script is from yt. I had someone on a other post make it into a rank script for me but seems to not be working.

no, it should not be a local script

Then I am a bit lost on the script.

idk what your current script looks like, but if you go back to this one ^, you need to change the >-

This is a script:

script.Parent.MouseButton1Click:Connect(function()
if game:GetService(“Players”).LocalPlayer:GetRankInGroup(13824371) <= 3 then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Br. Br. yellowish orange”)

	wait(0.5)

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

end)

I’m pretty sure “Br. Br. yellowish orange” isn’t a valid BrickColor

and I thought you were trying to do the top 2 ranks in the group before
your current code says <= 3 (less than or equal to 3), so it would be people ranked 1, 2, 3, and people with no rank in the group

Ah yes, I am aware of the brick color but the would I do this >=

I dont understand what you’re trying to ask

Ok I have the script. But how would I make it for a rank above to go on the team. Like “==” “<=” “>=”

>= is “greater than or equal to” so the if statement would be “True” if the number on the left is the same or greater than the number on the right

in your case, you’d get the player’s rank on the left and check if it’s greater than or equal to 254
>= 254

You cannot use .LocalPlayer on a script

2 Likes

Well here is the Og script and the rank script.