Is it possible to give a certain dialogue to a certain player

I want to know if it is possible to give someone a dialogue option on an NPC if the player holds a certain tool?

Could you also tell me how to do it or you could give me an example.

2 Likes

You could use debounce and if the tool is equipped. Here is an example:

held = false
local tool = --tool location here

tool.Equiped:Connect(function()
if not held then
held = true
--Dialog Script here
end)

This MIGHT work but I don’t know because I’ve never done this type of thing before.
I don’t know how to make dialog scripts because I’ve personally never used them or needed them, sorry!

2 Likes

Thank you! Im gonna test it now

For now you might want to use print("Working!") or something to indicate that it’s working and try equipping the tool more then once.

1 Like

How would I use this. I want it so that when I pickup and item the dialogue will show up. Where do i put the script in the dialogue?

Just like @uhBlame said, I’ve never done something like this either however, I assume this would be locally in a player and you would call a RemoteEvent.

Do you think it is possible. The feature isn’t necessary so Im not bothered whether its added or not. If you don’t think it is I won’t bother

It is 100% possible, you just have to not give up.

Is your game singleplayer or multiplayer? If it’s multiplayer it might have to be a RemoteEvent but singleplayer a localscript should be fine. You can put it anywhere, but if you’re trying to make a certain text come up then put it in the dialog textlabel and once the tool is welded it’ll run the script and change the text.

held = false
local tool = --tool location here ex: game:GetService("Lighting")["Bat Model"]
local TXT = script.Parent.Text
local dialog = "TEXT HERE"
tool.Equiped:Connect(function()

if not held then
held = true -- Will make the held variable true so this cannot be fired twice.

for i = 1,#TXT do --This will make the typewriter effect
TXT.Text = string.sub(dialog,1,i)

wait()
end

end)

This may or may not work, I haven’t tested it nor made this before, so this is all off of memory.

These might be useful:

Got it. I will definitely try to find a way. It just the 2 ways I have tried have failed.
I tried making it so that the dialogue would be disabled if they weren’t holding the tool.
and I tried making it so that if its in the players backpack then the option would enable itself but it seems
it doesn’t work. I put a print(working) at the end but it just scans through the script and only prints through the script basically ignoring everything else

The dialogue im trying to make is the roblox one.
Capture
That is possibly why it might not be working

Roblox dialouge instances have to added inside the “Head” object in a npc to work, they create guis above the heads that the player can interact with.

1 Like

Then you could easily get rid the for i = 1,#TXT do part of the script I sent, and make it so that if held = true then it’ll be activated and you could see it.
I’ll try to replicate this soon to help you out further.

1 Like

No, Thats not the point. I have got the dialogue working its just i dont want a certain dialogue to show up unless the player has an item
E.G The player is told about a special key and if it is brought back to them the NPC will explain what it does but this dialogue doesnt show up unless the player has a key.

The player has now found the key and they go back to the NPC with it. The NPC explains what it can do and how to use it.

1 Like

Thank you! You have helped loads! :slight_smile:

No problem!
If you need anymore help PM me or just mention/reply to me and I’ll be glad to help!