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
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…
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
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.
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 )