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?
✓ ANSWER ACCEPTED
Is triggering dialogue through a script possible?
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:
We can see exactly where our trigger is
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
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Thanks! It works! This helps out a ton with my projects.
Awesome! Make sure you mark the answer as correct :)