Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a NPC chat?

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

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.

Ad
Log in to vote
0
Answered by 10 years ago

Use Dialog in Studio...

0
Nope reteach 0 — 10y
0
Its way easier shadowsonichedgehogx -2 — 10y
0
It is not what I am looking for. reteach 0 — 10y

Answer this question