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

What is wrong with this script?

local function showGUI(hit)
	local h = hit.Parent:findFirstChild("Humanoid")
	if h ~= nil then
		game.StarterGui.level.Frame.Visible = false
		wait()
		game.StarterGui.Shop.Shop.Visible = true
	end
end

script.Parent.Touched:connect(showGUI)

When I walk into the brick, it doesn't remove my level.Frame, and doesn't show the Shop.Shop? Help is appreciated, thanks!

5 comments

0

:FindFirstChild() case sensitive

0

no...it is :findFirstChild()

0

Both are correct ^

1

:findFirstChild() is deprecated, use :FindFirstChild().

0

^

1 answer

✓ Accepted answer

StaterGui is a holding folder, when a player is added it replicates to Player.PlayerGui.

To interact do

game.Players[h.Name].PlayerGui.Level.Frame.Visible = false

I would also recommend

game.Players:WaitForChild(h.Name):WaitForChild("PlayerGui"):WaitForChild("Level"):WaitForChild("Frame").Visible = false

2 comments

0

when i replaced lines 4-6 with that code, it gave me this error "Humanoid is not a valid member of Players"

0

never mind I fixed it: game.Players[h.Parent.Name].PlayerGui.level.Frame.Visible = false

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