Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a Gui only can be seen the person that is in the group see it?

Hello, my name is dog6779. This is my first time scripting.

Problem

I trying to make a Gui where it pops up but ONLY GROUP MEMBERS can only see it. But I want it where it does its animation. By the way, it is in a folder which I would be organized most of the time. As you can see the main:TweenPosition(UDim2.new(0.284, 0,0.201, 0), "Out","Bounce",0.5) that a animation to make where it get clicked then it pops up.

Script

game.Workspace.Computers.Computer1.Screen.ClickDetector.MouseClick:Connect(function(playerInGroup)
	game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankinGroup(4222666) == 0 then
			if open == false then
			Player.PlayerGui.Main.Frame.Visible = false
			main:TweenPosition(UDim2.new(0.284, 0,0.201, 0), "Out","Bounce",0.5)
			if close == true then
				Player.PlayerGui.Main.Frame.Visible = true
				main:TweenPosition(UDim2.new(0.284, 0, 1, 0), "Out","Bounce",0.5)
			end
		end)
	end
end)
print("Frame Open!")

Please tell me what I do wrong?

3 comments

0

You’re modifying the PlayerGui on the server. That’s what’s wrong.

0

But how do I fix it?

0

Edited.

1 answer

✓ Accepted answer

###There is lots of unnecessary code, especially the MouseClick inside the PlayerAdded event. Not necessary. Also, you’re trying to modify PlayerGui from the server, which is not good. Fire a RemoteEvent to the client if they are in the group.

-- Server Script, inside Workspace.Computers.Computer1.Screen

local rep = game:GetService"ReplicatedStorage"
local showGui = rep:WaitForChild"ShowGui"
--RemoteEvent under ReplicatedStorage^ 

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
    if plr:IsInGroup(4222666) then
        -- instead of checking the rank, check if they’re in the group
        showGui:FireClient(plr)
    end
end)

###This is the local code.

--LocalScript, under PlayerGui.Main.Frame

local rep = game:GetService"ReplicatedStorage"
local showGui = rep:WaitForChild"ShowGui"
local out = Enum.EasingDirection.Out
local bounce = Enum.EasingStyle.Bounce
--Use Enum’s instead of strings

showGui.OnClientEvent:Connect(function()
    script.Parent.Visible = true

    script.Parent:TweenPosition(
        UDim2.new(.284, 0, 1, 0),
        out,
        bounce,
        0.5
)

end)

8 comments

0

Ah, now I see.

0

By the way on line 13 on the second script I see a error the one with the ;

0

There is no error?

0

Here I will send a screen shot.

0

he made a typo, use the new code.

0

Somehow I tryed to get it to work but it does not work for no reason.

This discussion is preserved as it was. New answers, comments, and votes are closed.