GetRankIngroup Nil

Hey Developers,

Does anybody know why this is happening? I’ve been using this method for ages and I’ve never got this error before.

script.Parent.MouseButton1Click:Connect(function(Player)
	if Player:GetRankInGroup(3620732) >= 20 then
		script.Parent.Parent.Visible = false
		script.Parent.Parent.Parent.MainPage.Visible = true
	end
end)

image

The MouseButton1Click function does not pass the player as an argument. You’ll have to define the player outside and above of your function like so (assuming you’re using a LocalScript).

local Player = game.Players.LocalPlayer

MouseButton1Click does not pass an argument Player.

This isn’t a local script. It’s just a normal script for a surface gui.

That doesn’t make any difference, the player is not a parameter passed to the callback function. You will have to retrieve the player in another way

You should use RemoteEvent because server script cannot find who clicked ui element.

So use RemoteEvent if you wanna make a global change when the ui is clicked.

Or, you can just use LocalScript and game.Players.LocalPlayer if you wanna make a client sided change. (Not visible for other players)

This may help you if you’re new to remote thingy.

So what is the functionality of the button? Just trying to understand better

When you press the button it makes the login frame invisible and the home page visible. I know I could do this with remote events but I’ve gotta make like 7 of these and don’t really wanna go through the hassle of doing all the remote events.

Gotcha. Are all your login UIs the same?

Yes they are indeed. charrssss

Alright. I suggest you use 1 SurfaceGUI for all of your login parts. Tag your parts with CollectionService, and have the GUI parented to the nearest part (constantly updated with RunService). You can then use (just 1) RemoteEvent to send admin actions from the client to the server.

Keep in mind, that you may want to parent your SurfaceGUI to the client in order for it to work properly.