-- setup local variables local attendent = game.Workspace.AttendentBrick -- when player clicks on attendent brick it will open gui if they are in group and certain rank attendent.ClickDetector.onclicked:connect(function() if (game.Players.LocalPlayer:IsInGroup(555451)) then game.Lighting.FlightAttendentGui:Clone() clo = game.Lighting.FlightAttendentGui:Clone() clo.Parent = game.LocalPlayer.StarterGui end 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.
-- setup local variables local attendent = game.Workspace.AttendentBrick -- when player clicks on attendent brick it will open gui if they are in group and certain rank 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" 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. game.Lighting.FlightAttendentGui:clone().Parent = p.PlayerGui -- Proper descendants end 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?