Hello!
I am quite new to scripting and can’t figure out why my script isn’t changing the text on my text label…
I am attempting to create a simple dialogue exchange with an NPC. How my script works is the player interacts with a proximity prompt, then connecting a function to the proximity prompt being triggered it will edit the text to say “Hello!”
Nothing is coming up in the output and I’m quite confused on how I should fix this.
local ui = script.Parent.Parent
local proxes = game.Workspace["Teleports/ProximityPromts"]
proxes.NPCDialog.Tibb12Dialog.ProximityPrompt.Triggered:Connect(function()
script.Parent.DiolaugeText.Text = ("Hello!")
end)
DialougeText = TextLabel
Hopefully some of you smarter people can help me out with finding a solution.
Thank you!
First of all, you don’t need the brackets around Hello. Simply "Hello" should work. 
I do have a few questions to help fix the problem though. To begin with, is the NPC interaction a ScreenGui or SurfaceGui? Could you please show us the explorer with the proximity prompt and text to show us the ancestry.
1 Like
It is a ScreenGui
Here is where the ProximityPrompt is

Here is where the text is

Thanks!
Hm, this is interesting. From what I can see, there’s no errors in the syntax. I believe the issue is coming from the object being referenced before it loads in, which messes up the script.
local proxFolder = game.Workspace:WaitForChild("Teleports/ProximityPromts")
local dialogueProx = proxFolder.NPCDialog.Tibb12Dialog:WaitForChild("ProximityPrompt")
dialogueProx.Triggered:Connect(function()
print("ProximityPrompt Triggered") -- For debugging, remove once working
local textBox = script.Parent.DiolaugeText
textBox.Text = "Hello!"
end)
1 Like
This worked!
I honestly have no idea why mine wasn’t working in the first place, as our scripts are so similar but hey I won’t complain.
Thank you so much!