Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does it suspend the running animation?

Asked by 4 years ago
Edited 4 years ago

I made a 2D script where it makes the Player Camera Follow him in 2D like in Super mario and other games but it suspends the running animation can someone help me with this?

local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
repeat
  wait()
until Player.Character
local Character = Player.Character
local Player_Torso = Character.HumanoidRootPart
local BodyPositioner = Instance.new("BodyPosition", Player_Torso)
BodyPositioner.MaxForce = Vector3.new(0, 0, math.huge)
BodyPositioner.Position = Vector3.new(0, 0,Player_Torso.Position.Z)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Player_Torso
game:GetService("RunService").RenderStepped:connect(function()
 Camera.CFrame = CFrame.new(Player_Torso.CFrame.X, Player_Torso.CFrame.Y, Player_Torso.CFrame.Z + 30)
 Camera.FieldOfView = 80
end)

now i explain things REALLy confusingly and sorry if it is really confusing EDIT: when you die it the camera doesnt shift to the player Position

1 answer

Log in to vote
1
Answered by 4 years ago

Alright, i'm going to constantly do edits to this but try adding an if statement for when the character dies. Something in this sense. If player respawns, find local player. Something along those lines. I don't know A LOT about the Character section nor the camera functions so i'm just going through what I can.

Ad

Answer this question