Hello everyone! Recently I worked on creating an FPS with an FPS kit tutorial and I ran into a problem. I am using this lerp script to lerp from the just killed player to the player that killed them. Everything works really well except, when it finishes lerping, it doesn’t go back to the original camera. It’s stuck in a position where the killer’s head was. I get this warning: “RunService:UnbindFromRenderStep removed different functions with same reference name killcam 2 times.” Any suggestions?
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")
runService:UnbindFromRenderStep("killcam")
character = workspace:WaitForChild(game.Players.LocalPlayer.Name)
script.Parent.Visible = false
CurrentCamera.CameraSubject = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name):WaitForChild("Humanoid")
CurrentCamera.CameraType = Enum.CameraType.Custom
end
end)
end)
end)