Everytime I play this animation it plays for the player rig but whenever the camera is set to the camera model it just falls over? I’ve tried anchoring the hrp and unanchoring everything else but then it just stands still? (also set the primary part to hrp)
here are my scripts
Module Script:
local animPlayer = {}
local rs = game:GetService("RunService")
local animFolder = script.Parent
local humAnimation = animFolder:WaitForChild("Hum")
local camAnimation = animFolder:WaitForChild("Cam")
local camRig = animFolder.Parent:WaitForChild("CameraRig")
function animPlayer:PlayAnimation(char: Model)
local hum = char:FindFirstChildOfClass("Humanoid")
local animator = hum:FindFirstChildOfClass("Animator")
local hrp = char:FindFirstChild("HumanoidRootPart")
hum.WalkSpeed = 0
hum.JumpPower = 0
hum.AutoRotate = false
local camRig = camRig:Clone()
local camPart = camRig:FindFirstChild("Cam")
local camHRP = camRig:FindFirstChild("HumanoidRootPart")
local animatonController = camRig.Cam:FindFirstChildOfClass("AnimationController")
local camAnimator = animatonController:FindFirstChildOfClass("Animator")
camRig.Parent = workspace
local humtrack = animator:LoadAnimation(humAnimation)
local camTrack = camAnimator:LoadAnimation(camAnimation)
camRig:PivotTo(hrp.CFrame)
local weld = Instance.new("WeldConstraint")
weld.Part0 = hrp
weld.Part1 = camHRP
weld.Parent = camHRP
local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
local connection: RBXScriptConnection = rs.RenderStepped:Connect(function()
cam.CFrame = camPart.CFrame
end)
humtrack:Play(0)
camTrack:Play(0)
task.wait(humtrack.Length)
camRig:Destroy()
connection:Disconnect()
cam.CameraType = Enum.CameraType.Custom
hum.WalkSpeed = 16
hum.JumpPower = 7.2
hum.AutoRotate = true
end
return animPlayer
Local Script:
local rs = game:GetService("ReplicatedStorage")
local cinematicAnimations = rs:WaitForChild("CinematicAnimations")
local example1 = cinematicAnimations:WaitForChild("Example1")
local animPlayer = require(example1:WaitForChild("AnimPlayer"))
local plrs = game:GetService("Players")
local lp = plrs.LocalPlayer
local char = lp.Character or lp.CharacterAdded:Wait()
local cutsceneTrigger = workspace:WaitForChild("CutsceneTrigger")
local cd = 10
local db = false
cutsceneTrigger.Touched:Connect(function(touched)
if touched.Parent == char and not db then
db = true
animPlayer:PlayAnimation(char)
task.wait(cd)
db = false
end
end)