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

Trying to make a GUI pop up from a part but wont work??

So, currently, I am trying to make it so whenever you click a click detector, it makes a GUI pop up. Can you try to help me?

Part 1 (Local Script):

local RepliactedStorage = game:GetService("ReplicatedStorage")
local ShowGUI = RepliactedStorage:WaitForChild("ShowGUI")
local ClickDetector = game.Workspace.Part.ClickDetector
local Gui = game.StarterGui.ScreenGui.Frame

ClickDetector.MouseClick:Connect(function()
	print("Recived")
	ShowGUI:FireServer(Gui)
	print("Success")
end)

This basically fires the remote event when you click the part

Part 2 (Script):

local RepliactedStorage = game:GetService("ReplicatedStorage")
local ShowGUI = RepliactedStorage:WaitForChild("ShowGUI")
local Gui = game.Players.LocalPlayer.Playergui.ScreenGui.Frame

ShowGUI.OnServerEvent:Connect(function(player, gui)
	Gui.Visible = true
end)

This script activates when the remote event is fired, and tries to make the GUI visible but doesn't work? Help me, please!

Output:

05:27:55.391 - Baseplate auto-recovery file was created
  05:27:55.836 - ServerScriptService.ServerScriptShowGui:3: attempt to index nil with 'Playergui'
05:27:55.837 - Stack Begin
05:27:55.837 - Script 'ServerScriptService.ServerScriptShowGui', Line 3
05:27:55.838 - Stack End
  Recived
  Success

6 comments

0

I’m just going to say this right now, you went way to far. It’s simple but you made it hard, I can solve it but you are going to have to wait a couple of hours till I can get to my computer and test out the script for you.

0

Ok

0

U can do everything locally

0

No need for the remote event

0

Firing an event isn't necessary here since you are not trying to get a client to talk to the server, instead you could have it all done in the LocalScript

0

I know I could've, this was just to mess with RemoteEvents since I'm just learning them. And they are extremely valuable.

1 answer

✓ Accepted answer

Instead of firing client to server, you'll need to fire server to client. So, the part 1 script should be a Script and this is what it should be:

local RepliactedStorage = game:GetService("ReplicatedStorage")
local ShowGUI = RepliactedStorage:WaitForChild("ShowGUI")
local ClickDetector = game.Workspace.Part.ClickDetector

ClickDetector.MouseClick:Connect(function(plr)
    local gui = plr.PlayerGui.ScreenGui.Frame
    print("Recived")
    ShowGUI:FireClient(plr, gui) -- Fire the player along
    print("Success")
end)

And put this in the StarterPlayerScript, as a LocalScript.

local RepliactedStorage = game:GetService("ReplicatedStorage")
local ShowGUI = RepliactedStorage:WaitForChild("ShowGUI")

ShowGUI.OnClientEvent:Connect(function(player, gui)
    gui.Visible = true
end)

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