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

Why is roblox studio incorrectly saying something is not a child of something?

I'm trying to make it so when a player touches a part one of their gui's get enabled, but i keep getting an error saying 'PromptGui is not a valid member of PlayerGui' on line 11 of the script below:

local border = script.Parent
border.Touched:Connect(function(part)
	local humanoid = part.Parent:WaitForChild("Humanoid", 2)
	print("Border Touched")
	if humanoid then
		print("there is humanoid")
		local playerName = humanoid.Parent.Name
		local player = game.Players:WaitForChild(""..playerName, 2)
		if player then
			print("there is player")
			local promptGui = player.PlayerGui.PromptGui
			if promptGui then
				print("there is prompt gui")
				promptGui.Frame.EnterPosition.Value = CFrame.new(77.405, -52.193, -207.59)
				promptGui.Frame.ExitPosition.Value = CFrame.new(68.5, 5.445, -245.5)
				promptGui.Enabled = true
				print("Prompted")
			else
				print("prompt gui not found")
			end	
		else
			print("player not found")
		end
	else
		print("humanoid not found")
	end
end)

Screenshot of output, explorer, and script

1 answer

✓ Accepted answer

This happens when you're trying to do something with the gui from the server.

The gui is client-side only, the server can't touch it. It'll return ".. gui not valid member of PlayerGui"

To make the gui server-sided, use RemoteEvents.

Look up tutorials on youtube or the wiki on how to use :FireClient()

https://www.robloxdev.com/api-reference/function/RemoteEvent/FireClient

1 comment

0

thank you so much i was so confused

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