Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a NPC chat?

The goal of this script is that when ever someone touch's the invisible block near the npc the npc will say G'day and then the players name who touched the block

button = game.Workspace.Talk

function onTouch(other)
	local human = other.Parent:FindFirstChild("Humanoid")
	if not human then return end
	local player = game.Players:GetPlayerFromCharacter(other.Parent)
	if not player then return end
	local color = "Blue" --This can also be "Green" or "Red"
	game:GetService("Chat"):Chat(script.Parent, "G'Day"..player.Name, color)
	wait(interval)
	end
button.Touched:connect(onTouch)

2 answers

✓ Accepted answer

I get what you wanted to do but I'm not sure what was wrong with the script. It might have been because you had a ' in the G'day. Because a ' and a " are used for string values and can glitch the script. So you should just put Good day instead of G'day.

This discussion is preserved as it was. New answers, comments, and votes are closed.