Unlock mouse when a player starts a dialogue with an NPC

So my game is currently locked in first person and I want it so that when a player starts a dialogue with an NPC, the mouse (locked in the centre of the screen by default) to unlock and the user can select a response. I don’t know how to unlock it.

How would I go to unlocking the mouse?

Here is my current script, which doesn’t work… (located in the dialogue in the NPC’s head):

workspace["Captain Ben"].Head.Dialog.DialogChoiceSelected:Connect(function()
	local player = game:GetService("Players").LocalPlayer
	local UIS = game:GetService("UserInputService")
	UIS.MouseBehavior = Enum.MouseBehavior.Default
end)

https://developer.roblox.com/en-us/api-reference/property/Player/DevEnableMouseLock

Is there a way I can find the GUI linked to the dialogue on the players screen? (To locate the modal)