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

Is triggering dialogue through a script possible?

I am trying to make dialogue trigger through a script when a proximity prompt is triggered. But there doesn't seem to be anything that can trigger it. Any help with this?

1 answer

✓ Accepted answer

Hello,

To start let's create an example prompt function:

local function prompt(player)
	print(player.Name.."! You have been prompted!!!")
end)

Okay, now that we have an example prompt, we can start to focus on our trigger. There are various ways we could make a trigger, but I think the easiest would be for us to just place an invisible, non-collidable part wherever we want the trigger area to be. This is good for a few reasons:

  1. We can see exactly where our trigger is

  2. Less coding required if you're a beginner in Lua

After placing the part, we place a script inside of it with the following code:

local function prompt(player)
	print(player.Name.."! You have been prompted!!!")
end)

script.Parent.Touched:Connect(function(bodypart)
	prompt(bodypart.Parent)
end)

Hopefully, this sets you in the right direction.

Cheers,

Chase

2 comments

0

Thanks! It works! This helps out a ton with my projects.

0

Awesome! Make sure you mark the answer as correct :)

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