I have a problem and it is that the camera won’t set to the NPC. I’m trying to change the camera in front of the NPC while the dialog is running.
From what I’ve observed the CameraType property is not changing whenever I run the code :
Camera.CameraType = Enum.CameraType.Scriptable
It stays as Custom and never changes to Scriptable.
Here is my code hopefully someone helps with a solution. Everything works except that the Camera doesn’t do anything.
local Camera = workspace.CurrentCamera
local CameraPart = script.Parent.CameraPart
local function enterCamera(player)
repeat wait() until player.Character
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPart.CFrame
end
local function exitCamera()
if Camera.CameraType == Enum.CameraType.Scriptable then
Camera.CFrame = Camera.CFrame
end
end
local firstmessage = {"Hello there!", "I have some props to offer for you!"}
script.Parent.ProximityPart.Attachment.ProximityPrompt.Triggered:Connect(function(plr)
plr.PlayerGui.NPCDialogue.Enabled = true
plr.PlayerGui.NPCDialogue.Frame.NPCName.Text = "---"
enterCamera(plr)
for i, v in pairs(firstmessage) do
for i = 1, string.len(v) do wait(0.025)
plr.PlayerGui.NPCDialogue.Frame.Message.Text = string.sub(v, 1, i)
end
wait(string.len(v) / 10)
end
-- plr.PlayerGui.NPCDialogue.Frame.OpenButton.Visible = true
-- plr.PlayerGui.NPCDialogue.Frame.ContinueButton.Visible = true
-- plr.PlayerGui.NPCDialogue.Frame.ExitButton.Visible = true
exitCamera()
end)