How would you use GetRankInGroup to find a players rank using a SurfaceGui Button?
I would like it so that it is used within a "if" function that I am doing.
player = game.Players.PlayerAdded
loading = false
script.Parent.MouseButton1Down:connect(function()
if loading == false then
loading = true
print("Login")
script.Parent.Text = ("Logging In")
wait(0.5)
script.Parent.Text = ("Logging In.")
wait(0.5)
script.Parent.Text = ("Logging In..")
wait(0.5)
script.Parent.Text = ("Logging In...")
wait(0.5)
script.Parent.Text = ("Logging In")
wait(0.5)
script.Parent.Text = ("Logging In.")
wait(0.5)
script.Parent.Text = ("Logging In..")
wait(0.5)
if player:GetRankInGroup(731703).Value == true then
script.Parent.Text = ("Access Accepted")
wait(2)
script.Parent.Text = ("Welcome!")
wait(1)
game.ServerStorage.TerminalData.Host.Value = true
script.Parent.Text = ("Click To Login")
loading = false
else
script.Parent.Text = ("Access Denied")
wait(2)
script.Parent.Text = ("Click To Login")
loading = false
end
end
end)

12 comments
I will try it!
Where would the instance usualy be?
Where is this script running? and what method is being triggered? e.g Touched:connect()
Script is running like so Workspace,TerminalSystems,Terminal,Screen,SurfaceGUI,Frame,Button,script.(Really far!). I want it trigged as in a button on the screen..
1st you need to add in the button click event if you have not allready done it http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Click
2nd add this line in print(script.parent) add .parent until the player name is displayed e.g print(script.parent.parent)
I done that, Let me get the script on the page.
3rd add this plr = game.Players:GetPlayerFromCharacter( all of the code inside the brackets of the print function) This will return a player instance which can be used with the code above
OK
just in case you dont know but to show the output window you need to go to view->output
That is easy. I know how to script, just could not figure out how to find the player and GetRankInGroup. I usualy do it through a part.
Thanks!