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)
Found the answer. For anyone wanting to know how to do this, everything was correct except I was being dumb and never named the value. Feel free to use my script to help you!