Help me with client gui check

Hi,
So i was making a gui on roblox studio for a project in another game, but the gui is on a localscript.
i need to check in the client if a player has the gui, and then if they do, i need it to run a script.
And the dev said i cant use events so i need to find another way to do it

Does anyone have any idea on how would i do this?
It could literally be the worst possible way to do it, i just need it somehow. i tried many things and nothing worked

1 Like

You need to check if they have the actual GUI, or if they have access to it?

local player = game:GetService("Players").LocalPlayer
local gui = player:WaitForChild("PlayerGui"):FindFirstChild("MyGUI")
if gui then
  ---
end

Might not need that extra WaitForChild, up to you.
Otherwise you’ll need to do some sort of custom check if they have access to use the GUI.

I forgot to point out, it cant be on server.

What do you mean it can’t be on the server? No scripts on the server? Are you trying to check for the gui and let the server know?

Im trying to find a way for a gui (created from a localscript) to detect if another person has the same gui (created from a localscript)

This isn’t something that can be done locally without a RemoteEvent, clients aren’t directly connected to each other. However, if you stick something in StarterGui, every player will have it…

You would need to go from one user to the server and from the server to another. You can’t send things directly to others clients from a client.

Strange, i saw someone else do it. and they tried to do the same thing i want

Are you able to provide us with the source?

I dont have the code, and i never added them, so i cant even ask them for it

Me and my friends tried many things but nothing worked so yeah i think i will close this since there isnt anything i can do

I see. In any case, it’s better to do this kind of check on the server anyway. Going from client to server to client takes more time and resource than server to client. Additionally, if you need to protect this from exploiters, putting it on the server will prevent people from accessing it since they can only view client-sided elements.

Yeah, i was looking for any way really, like changing the player’s walkspeed to a value and then checking if the player had that speed from the other gui but i guess no one can find a way to do it for me. But thanks anyways

its like guessing to each players to know other players walkspeed?

2 Likes

I want for one gui created by a local script to know if someone else has the same gui (created by a local script too)

No server scripts.
only local ^^
No remotes

im still a bit confused
like this?

local ScreenGui = "MyScreenUiName" -- Name of the ui

local ListOfPlayersHasTheUi = {} -- Players has the same ui

for _, Players in pairs(game.Players:GetPlayers()) do
	local PlayerGui = Players:WaitForChild("PlayerGui")
	if PlayerGui:FindFirstChild(ScreenGui)	 then
		table.insert(ListOfPlayersHasTheUi, Players)
	end
end

Kind of. i want that, but on a localscript
that is server i believe (local scripts cant access other people’s guis?)
thats why i asked for a different way since local scripts cant access other people’s guis.

oh it will run both cuz i just get the player
GetPlayers() just get childrens in da player service so nothing agruments

The code (to find players with the gui) must be on a localscript, are you sure client can access other people’s guis?

assuming that u checking if a player has a gui considering the fact that u are on a localscript dis wat id do

local players = game:getservice(players)
local player = players.localplayer

for i,v in pairs (players:getplayers()) do
     if v.PlayerGui:FindFirstChild(guiname) then
             -- do script stuf
     end
end

(btw i wrote dis on the devforum so stuff might loo wkeird )