Scripting part.touched

It should be disabled so that when the part is touched the Gui is enabled.

local Players = game:GetService("Players")
local Part = script.Parent

Part.Touched:Connect(function(Hit)
	local HitModel = Hit:FindFirstAncestorOfClass("Model")
	if HitModel then
		local HitPlayer = Players:GetPlayerFromCharacter(HitModel)
		if HitPlayer then
			HitPlayer.PlayerGui.Winter.Enabled = true
		end
	end
end)

I’m trying to show the player the named location when they enter the part.

The GUI doesn’t show, I’m unsure why.

What is its name? Can you show a screenshot of everything inside StarterGui?

image

Make sure this property is disabled (not ticked).

For each GuiObject inside the ScreenGui make sure that its “Visible” property is enabled (ticked).

Should the Gui be enabled from the start? If so, use the following script to disable it when the part is touched. The previous script I provided was attempting to enable it (which would do nothing as it was already enabled).

local Players = game:GetService("Players")
local Part = script.Parent

Part.Touched:Connect(function(Hit)
	local HitModel = Hit:FindFirstAncestorOfClass("Model")
	if HitModel then
		local HitPlayer = Players:GetPlayerFromCharacter(HitModel)
		if HitPlayer then
			HitPlayer.PlayerGui.Winter.Enabled = false
		end
	end
end)

The GUI isn’t referenced in the script.

HitPlayer.PlayerGui.Winter.Enabled = false

This line of code here is disabling the Gui for the player when the part is touched by the player’s character.

It’s still not showing the GUI.

Refer to my earlier post, you need to disable the “Enabled” property before you launch the game, so that when the part is touched this property can be enabled and the Gui can be shown.

Taken from a previous reply:
image

Make sure this property is disabled (not ticked).

I have it disabled but still doesn’t show.