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?
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