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

Is triggering dialogue through a script possible?

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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

0
Thanks! It works! This helps out a ton with my projects. Andromedual 35 — 2y
0
Awesome! Make sure you mark the answer as correct :) NinjaManChase 226 — 2y
Ad

Answer this question