-
What do you want to achieve? I want the camera to follow and match the head’s rotation/orientation when an animation is playing on the character.
-
What is the issue? I can’t figure out how to make the camera follow and turn along with the head while playing an animation.
-
What solutions have you tried so far? I tried setting the camera subject to the head when playing the animation, but it didn’t seem to work as the player could still look around. Using watch as cameratype gave me slightly better results but the player could still turn the camera.
you can try this but if it is temporary we can activate it with a remote event
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
local camera = game.Workspace.CurrentCamera
local runs = game:GetService("RunService")
runs.RenderStepped:Connect(function()
camera.CFrame = head.CFrame
end)
you can also find a way to make the player head accesories invisible when the animation is playing
That actually looks like it’d work, I’ll try later. Thanks!
Can you show me an example of how I could make it temporary without a remote event, if possible?
Do you want to make the animation play after what? press a key or something?
It’s a death animation in a horror game, the player trips and turns over to the ghost and the camera zooms into the ghost’s head then goes black. It’s triggered when the player touches the ghost.
local bellany = script.Parent.Parent
local root = bellany.HumanoidRootPart
root.Touched:Connect(function(h)
if game.Players:GetPlayerFromCharacter(h.Parent) and h.Parent.Humanoid.Health >= 1 and bellany.Values.Hunting.Value then
local character = h.Parent
local humanoid: Humanoid = character.Humanoid
-- Stop hunting
bellany.Values.Hunting.Value = 1
-- Animation
humanoid.WalkSpeed = 0
for _, anim: AnimationTrack in pairs(humanoid.Animator:GetPlayingAnimationTracks()) do
anim:Stop()
end
humanoid.Animator:LoadAnimation(script.Trip):Play()
-- Disable script
script.Disabled = true
end
end)
he is an npc, I see that you are doing it from a script and not a local script, you need to do it with remote event
you need get the player’s name
and then u put this in your script
local remoteevent = game.ReplicatedStorage.RemoteEvent-------------------the location of your remote event
remoteevent:FireClient(plrname, trueorfalse)----------------------------------------this fires a event to the player with the same name
and then u need to put this in a local script
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
local camera = game.Workspace.CurrentCamera
local remoteevent = game.ReplicatedStorage.RemoteEvent-------------------the location of your remote event
local scream = false
local runs = game:GetService("RunService")
runs.RenderStepped:Connect(function()
if scream == true then
camera.CFrame = head.CFrame
end
end)
remoteevent.OnClientEvent:Connect(function(plr, activation)
if activation == true then
scream = true
else
scream = false
end
end)
you send a remote event to activate it and another to deactivate when the animation ends
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.