I made this script trying to give the GUI to the player (Which works fine) and then changing the text to the name of the NPC talking. And yes, the NPC has a string value with the value beings its name.
This is the error I keep getting as well:
18:00:44.402 - Workspace.Soldier.Part.Script:14: attempt to concatenate local 'NPCName' (a nil value) 18:00:44.4
Here's the script :
local Gui = game.Lighting.MapGui --Name of gui, be sure to put gui on lighting.
function GiveGui(Player)
if Player.PlayerGui:FindFirstChild(Gui.Name)~=nil then return end
Gui:Clone().Parent=Player.PlayerGui
end
script.Parent.Touched:connect(function(hit)
local Player=game.Players:GetPlayerFromCharacter(hit.Parent)
if Player==nil then return end
GiveGui(Player)
local NPCName = script.Parent.Parent.Name.Value
Player.PlayerGui.MapGui.Frame.Ya.Text = "Press 'Q' to speak with "..NPCName
end)

2 comments
Are you making sure that there's actually a name in that StringValue box? Because from the looks of it the script thinks it's empty.
Edited to fix code formatting