Module Script can't find Gui

Hello! I made a check for my module script and I ran it via a serverside script. I was wondering why it states that the GUI isn’t a child of PlayerGui yet it shows up on my screen? I ran a script to get all of my PlayerGui’s and it says only Free Camera is there.

https://gyazo.com/c1b29ee74d89cacdc5dc01485b9f6236

https://gyazo.com/1c98bbff6391f3c0fb18a301f6fe6ed6.gif

ws = game:GetService("Workspace")
objects = ws:FindFirstChild("DroppedObjects")
radius = 10

function checks(player,target,vtype)
	print(player.Name)
	if target then
		if (target.Position - ws:WaitForChild(player.Name).HumanoidRootPart.Position).magnitude <= radius then
			if target:IsDescendantOf(objects) then
				if vtype == 'guiCheck' then
					if player.PlayerGui.ItemDetection.Message.Visible == true then
						return true
					else
						return false
					end
				else
					return true
				end
			else
				return false
			end
		else
			return false
		end
	end
end

return checks

Notice | This script works in testing mode!

the server does not see guis in playergui, run the module from a localscript

1 Like

Hm, how should I check on the server if a gui is visible then? (to prevent exploits)

don’t rely on the gui being visible in order to check, use a value on the server

2 Likes