I am trying to make a GUI that will only be visible when a player with a certain rank presses a button it will show. But all I get is an error:

Players.blarfart.PlayerGui.SelfCheckIn.Checkin.TextButton.Script:2: attempt to index nil with 'GetRankInGroup'

Here's the script

script.Parent.MouseButton1Click:Connect(function(Player)
	if Player:GetRankInGroup(groupid) == 100 then 
		script.Parent.Parent.Parent.Parent.Admin:TweenPosition(UDim2.new(0.25, 0,0.742, 0), "Out", "Elastic", 2)
	end
end)

I am confused and have no idea what to do.

1 comment

0

MouseButton1Click doesn't have any parameters. Good advice: all GUI related components should be controlled using a localscript. Your Player should be game.Players.LocalPlayer https://i.imgur.com/mq699vJ.png