How to make when a part touched the npc talks and destroys the message whenever the player leaves the part

i wanna make the npc talks whenver the player touched the part and it destroys the message whenever the player left the part its a simple script but im new to programming
khowledge any ideas? i appreciate that.

1 Like

what type of message
if youre using textchatservice,

game:GetService("TextChatService"):Display(instance, "msg")

will say a message at the instance
you cant delete individual text bubbles though, so this is pretty much the best you can do

part.Touched:Connect(function(part)
    if game:GetService("Players"):GetPlayerFromCharacter(part) then
       game:GetService("TextChatService"):Display(instance, "msg")
    end
end)
1 Like

Connect touched
— chat code
Connect touch ended

yo is this running on a client script i wanna put this script under the rig.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.