Hello! So I am trying to make a kill cam that, instead of just switching to show the player who killed the other, tweens from the player who was killed to the killer. Then after a couple seconds, it should switch back to the Local Player. I created a script that kind of works? The game is first person but I want it to switch to third person when it tweens and then back to first person. Here’s the script:
local TweenService = game:GetService(“TweenService”)
local CurrentCamera = workspace.CurrentCamera
game.ReplicatedStorage.KillCam.OnClientEvent:Connect(function(exploder)
print(exploder)
CurrentCamera.CameraType = Enum.CameraType.Scriptable
local TI = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In,0)
local Goal = {CFrame = game.Workspace:FindFirstChild(exploder).Head.CFrame}
local Animation = TweenService:Create(CurrentCamera,TI,Goal)
Animation:Play()
It’s kind of an FPS. Is there a way to make it so that the camera is facing toward the killer’s head always and not first person? I hope that makes sense
I apologize for not writing back sooner, I’ve been busy recently. I actually ended up changing my code to this:
repeat wait() until game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character.Parent ~= nil and game.Workspace.CurrentCamera
local runService = game:GetService(“RunService”)
local player = game.Players.LocalPlayer
local character = player.Character
local camera = game.Workspace.CurrentCamera
local TweenService = game:GetService(“TweenService”)
local player = game.Players.LocalPlayer
local CurrentCamera = workspace.CurrentCamera
runService:UnbindFromRenderStep(“killcam”)
game.ReplicatedStorage.KillCam.OnClientEvent:Connect(function(exploder)
script.Parent.Visible = true
script.Parent.Text = "Exploded by "…exploder
pcall(function()
local alpha = 0.1 --0.5/2
local startCFrame = camera.CFrame
local killerChar = game.Workspace:FindFirstChild(exploder)
camera.CameraType = Enum.CameraType.Scriptable
runService:BindToRenderStep("killcam", 0, function()
if killerChar and killerChar:FindFirstChild("Head") then
local endcf = killerChar.Head.CFrame * CFrame.new(0, 3, 10)
camera.CFrame = CFrame.new(camera.CFrame:lerp(endcf, alpha).p, killerChar.Head:GetRenderCFrame().p)
wait(5)
print("Findished with camera")
script.Parent.Visible = false
CurrentCamera.CameraSubject = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name):WaitForChild("Humanoid")
CurrentCamera.CameraType = Enum.CameraType.Custom
end
end)
end)
end)
and it works really well. The only problem is, however, it won’t switch back to the player after they have watched the killer for a few seconds… any suggestions? I really don’t know much about RunService, just found this from a kit and changed it a bit so I might be doing something wrong.