-
What do you want to achieve?
In my game, I have a talking NPC and would like the camera to cut to the NPC while it’s talking. I also want the camera to tween between two parts once during the conversation. -
What is the issue?
When the proximity prompt is triggered the cutscene doesn’t play. I’ve followed AlvinBlox’s tutorial; however, he didn’t give an example with proximity prompts so I’ve been trying to do it myself. There are no other examples online that show me how to do it.
Here’s the Explorer set-up and scripts:
game.Workspace["Hello Kitty"].HumanoidRootPart.ChatProximity.Triggered:Connect(function(player)
local player = game.Players:GetPlayerFromCharacter(player.Parent)
if player then
game.ReplicatedStorage.RSCutscenes.HKCutscene:FireClient(player)
end
end)
local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
function tween(part1,part2,cutsceneTime)
local tweenInfo = TweenInfo.new(
cutsceneTime,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
0,
false,
0
)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutsceneTime)
camera.CameraType = Enum.CameraType.Custom
end
wait(2)
game.ReplicatedStorage.RSCutscenes.HKCutscene.OnClientEvent:Connect(function()
tween(game.Workspace.CutsceneCams.HKCam,game.Workspace.CutsceneCams.HKCam2,7)
tween(game.Workspace.CutsceneCams.HKCam2,game.Workspace.CutsceneCams.HKCam,10)
--tween(game.Workspace.CutsceneCams.Cam3,game.Workspace.CutsceneCams.Cam4,9)
end)
Script inside “Chat Proximity” which triggers GUI
I don’t know if this is relevant but thought I’d include it anyway!
local NPC = script.Parent.Parent.Parent
local TalkEvent = game:GetService("ReplicatedStorage"):FindFirstChild("NPCs").Npc
local Prox = script.Parent
script.Parent.Triggered:Connect(function(plr)
plr.Character.Humanoid.WalkSpeed = 0
plr.Character.Humanoid.JumpHeight = 0
local NpcName = NPC.Name
local M1 = script.Parent.Message1.Value
local M2 = script.Parent.Message2.Value
local M3 = script.Parent.Message3.Value
local M4 = script.Parent.Message4.Value
local M5 = script.Parent.Message5.Value
TalkEvent:FireClient(plr,NpcName, M1, M2, M3, M4, M5, Prox)
end)
TalkEvent.OnServerEvent:Connect(function(plr)
plr.Character.Humanoid.WalkSpeed = 16
plr.Character.Humanoid.JumpHeight = 7.2
plr.Character.Humanoid.JumpPower = 50
end)
Thank you for your time & help!