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
Well here is the Og script and the rank script.
Changed a script to this but is not working:
script.Parent.MouseButton1Click:Connect(function()
if game:GetService(“Players”).LocalPlayer:GetRankInGroup(13824371) >= 3 then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Mulberry”)
wait(0.5)
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
end)
does it give you any errors? check the output
oh, it’s saying that LocalPlayer doesnt exist because you’re using a script
you should work with a chain of script.Parent. … Parent to get the Player
How would I do that? Would I change local to parent?
you’d get the player similarly to what you did on the line where you set the health to 0 instead off using LocalPlayer
Like this?
script.Parent.MouseButton1Click:Connect(function()
if game:GetService(“Players”).Parent:GetRankInGroup(5122099) >= 3 then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Mulberry”)
wait(0.5)
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
end)
no, you need to search through the ancestors of the script to find the player
Oh ok, how would I do that?? I am not sure how.
one way would be to use script.Parent and have a bunch of .Parent
another way is to use script:FindFirstAncestorOfClass(“Player”) to have the script check each parent until it finds the player for you
Like this?
script.Parent.MouseButton1Click:Connect(function()
if game:GetService(“Players”)FindFirstAncestorOfClass(“Player”):GetRankInGroup(5122099) >= 3 then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(“Mulberry”)
wait(0.5)
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
end)
you’d find the first player ancestor of the script, not of game.Players
How would I do that?? Not sure how to.
use script:FindFirstAncestorOfClass("Player")
, not game:GetService("Players"):FindFirstAncestorOfClass("Player")