Script not executing

I’m making a pretty simple game and am using a few NPCs. I’m not the greatest scripter, but I was attempting to make text pop up when you hit a button to speak to the NPC. When I test the game, the text GUI does not appear when I see no reason why it shouldn’t. ( No errors ever pop up in the output either ). Here’s the script, is there anything preventing it from outputting the GUI? ( first bits of scripts are just to move the npc and prevent player from clicking button twice )

-- script.Parent.ProximityPrompt.Triggered:Connect(function()
	script.Parent.Humanoid.WalkToPoint = Vector3.new(-154.5, 0.5, -109.5)
	script.Parent.ProximityPrompt.Enabled = false
	game.StarterGui.Text1.Enabled = true
	
end)
2 Likes

Is it a local script inside Workspace? If so, try to put it inside StarterPlayerScripts ;D

3 Likes

delete the “–” maybe? or its just there for some other reason

2 Likes

You need to use PlayerGui for the text to appear on the player screen.

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	script.Parent.Humanoid.WalkToPoint = Vector3.new(-154.5, 0.5, -109.5)
	script.Parent.ProximityPrompt.Enabled = false
	player.PlayerGui.Text1.Enabled = true
end)
3 Likes

thats not actually in the script, just there to show the start of the script within devforum

1 Like

oh ok i misunderstood

30char?

1 Like

You’re making the UI in StarterGui visible, which doesn’t affect current players in-game, as they have their own PlayerGui. In your event parameter, define the player, and enable the UI in their PlayerGui:

local part = script.Parent
part.ProximityPrompt.Triggered:Connect(function(plr)
    part.Humanoid.WalkToPoint = Vector3.new(-154.5, 0.5, -109.5)
	part.ProximityPrompt.Enabled = false
    plr.PlayerGui.Text1.Enabled = true
end)
3 Likes

Ah, okay I see. So for things within starterGUI, they will be on the players screen from the start if enabled ( such as title screen ) and you have to access playerGUI if you want to enable a GUI within the gameplay?

2 Likes

Yes, if you change the StarterGui, it’ll be visible to newcomers. Doing PlayerGui will only affect the player that triggered the prompt.

3 Likes