How to signify to player Gui?

You can write your topic however you want, but you need to answer these question:

  1. What do you want to achieve? Keep it simple and clear!
    I want this function to work on player gui not starter gui
    and why script doesn’t print “WelloThere”? like it has to?
print("wellloThere")
ExitButton.MouseButton1Click:Connect(function()
	print("Kemonoji")
	local player = players:GetPlayerFromCharacter()
	remotes.ShopClose:FireClient(player)
print("WeSendTheData")	
end)

here is the whole script ss if you need

it doesn’t print “wellothere”, “kemonoji” and “WeSendTheData”

1 Like

The Gui button variables are set to StarterGui but it should be PlayerGui

so I just have to replacec StarterGui with PlayerGui?

You don’t need to use a server script for this case. This type of script should local unless you need to transfer some specific data over to the server. Like if you were to buy something with the GUI the money and stuff needs to be handled on the server.
Bruh… I just noticed your gui names.
If you simply need an exit button for you Gui I would make a separate LocalScript inside the exit button and just run the function from there.

well I am tryint to sent fireClient event so I thought I had to . Well I guess I can just put it to local script and parent it to starter gui but I want to learn doing it in a server script becase I will definetly need it later

Edit: Btw replacing starterGui with PlayerGui didn’t worked cause I still don’t know how to get playerGui with script

I want to do it while using server script because I want to learn how to use RemoteEvents completly…
and Thanks to that I learned I didn’t know how to meintoin playergui from server script

I don’t quite understand what you’re asking for. But if you want to access PlayerGui, just do this:

local Player = game:GetService("Players").LocalPlayer -- Read: Gets the local player, only do if it's a local script)

Player.PlayerGui. -- Whatever you want.

After rereading everything it seems like you’re trying to open a Gui when the player touches a part in workspace? If that’s the case the touched event should fire the event to the client →

→Now on a separate LocalScript on the client will handle all the Gui behaviors. You need 2 separate scripts for remote events one for the client and one for the server.