01 | -- setup local variables |
02 | local attendent = game.Workspace.AttendentBrick |
03 | -- when player clicks on attendent brick it will open gui if they are in group and certain rank |
04 | attendent.ClickDetector.onclicked:connect( function () |
05 | if (game.Players.LocalPlayer:IsInGroup( 555451 )) then |
06 | game.Lighting.FlightAttendentGui:Clone() |
07 | clo = game.Lighting.FlightAttendentGui:Clone() |
08 | clo.Parent = game.LocalPlayer.StarterGui |
09 | end |
10 | end ) |
The localscript is under the player. I want it to be when they click a brick, a gui will open up only if they are in a group. Sorry it must be bad since my main focus is building.
A couple of mistakes. I put some comments for you.
1 | -- setup local variables |
2 | local attendent = game.Workspace.AttendentBrick |
3 | -- when player clicks on attendent brick it will open gui if they are in group and certain rank |
4 | attendent.ClickDetector.MouseClick:connect( function (p) -- The proper event name is "MouseClick". The player is the one and only parameter. I have it set as "p" |
5 | if (p:GetRankInGroup( 555451 ) > 1 ) then -- Since you said a certain rank, you have to use the GetRankInGroup method. You can change the number. By default, I have it as 1, which means they're in the group. |
6 | game.Lighting.FlightAttendentGui:clone().Parent = p.PlayerGui -- Proper descendants |
7 | end |
8 | end ) |
Locked by Shawnyg, EzraNehemiah_TF2, and adark
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?