Why the game doesn't detect Humanoid

I’m trying to do a simple tween betwen cameras and i got an advanced script in a test zone where i dont get an error i copied the same local for the humanoid and in the console says “Humanoid is not a valid member of Model “Workspace.michuchito””

Heres the script i used

--localizacion de recursos
local Jugador = game.Players.LocalPlayer
local Character = Jugador.Character or Jugador.CharacterAdded:Wait()
local humanoid = Character.Humanoid
local GuiDelJugador = Jugador.WaitForChild("PlayerGui")

local TweenS = game:GetService("TweenService")
local TweenI = TweenInfo.new(1)

--localizacion de camaras
local CamaraJugador = game.Workspace.CurrentCamera
local CarpetaCamaras = game.Workspace.Camaras
local Camara1 = CarpetaCamaras.Camara1
local Camara2 = CarpetaCamaras.Camara2
print("Camara")
--localizacion del GUI

--animacion de la intro
local function IntroActivada()
	humanoid.WalkSpeed = 0
	CamaraJugador.CameraType = Enum.CameraType.Scriptable
	CamaraJugador.CFrame = Camara1.CFrame
	task.wait(0.5)
	local AnimacionCamara1 = TweenS:Create(CamaraJugador,TweenI,{CFrame = Camara2.CFrame})
	AnimacionCamara1:Play()
	AnimacionCamara1.Completed:Wait()
end

--hacer que la animacion se reproduzca solo cuando el juego este cargado
repeat wait() until game:IsLoaded()
wait(0.5)
IntroActivada()

I can also send the script in the test zone if needed

1 Like
local humanoid = Character:WaitForChild("Humanoid")

function trying to access humanoid before its created so you need to add waitforchild

i actually tried that before and didnt work, the error just change to
image
just so you dont think im dumb this is the code is using

local GuiDelJugador = Jugador.WaitForChild("PlayerGui")

have dot instead of :
heres fixed

local GuiDelJugador = Jugador:WaitForChild("PlayerGui")

got the same error, i tried deleting the GUI local and the game just said this
image
i rebooted studio and didnt solve nothing

1 Like

are you using camera instances or cframe values to store position+rotation data?

here is how your folder should look (CFrameValue instances)
image

here is fully updated script and dont forget uncomment jumppower/height thing to prevent player jumping while cutscene

--localizacion de recursos
local Jugador = game.Players.LocalPlayer
local Character = Jugador.Character or Jugador.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")

local TweenS = game:GetService("TweenService")
local TweenI = TweenInfo.new(1)

--localizacion de camaras
local CamaraJugador = game.Workspace.CurrentCamera
local CarpetaCamaras = game.Workspace.Camaras
print(CarpetaCamaras:GetChildren())
local Camara1 = CarpetaCamaras:WaitForChild("Camera1")
local Camara2 = CarpetaCamaras:WaitForChild("Camera2")
print("Camara")
--localizacion del GUI

--animacion de la intro
local function IntroActivada()
	humanoid.WalkSpeed = 0
	--humanoid.JumpHeight = 0 uncomment and delete other one if game uses jumpheight
	--humanoid.JumpPower = 0 uncomment and delete other one if game uses jumppower
	CamaraJugador.CameraType = Enum.CameraType.Scriptable
	CamaraJugador.CFrame = Camara1.Value
	task.wait(0.5)
	local AnimacionCamara1 = TweenS:Create(CamaraJugador,TweenI,{CFrame = Camara2.Value})
	AnimacionCamara1:Play()
	AnimacionCamara1.Completed:Wait()
end

--hacer que la animacion se reproduzca solo cuando el juego este cargado
repeat task.wait() until game:IsLoaded()
task.wait(0.5)
IntroActivada()

this could work but i need to move things in the Gui after the first animation

i deleted

local GuiDelJugador = Jugador:WaitForChild("PlayerGui")

cuz it was not used in script you provided but if theres other stuff in script that moves gui you need to add this back

i solved it, idk why but i needed to use :WaitForChild in all the instances

local jugador  = game.Players.LocalPlayer
local Character = jugador.Character or jugador.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")

--Datos del TweenService
local TweenS = game:GetService("TweenService")
local TweenI = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)

--Localizacion de Camaras/Parts
local CamaraJugador = game.Workspace.CurrentCamera
local Camaras = game.Workspace.Camaras
local Camara1 = Camaras:WaitForChild("Camara1")
local Camara2 = Camaras:WaitForChild("Camara2")

--localizacion del Gui
local BotonPlay = game.StarterGui.IntroGui.Frame:WaitForChild("Play")
local GuiDelJugador = jugador:WaitForChild("PlayerGui")

--animacion de la intro
local function IntroActivada()
	humanoid.WalkSpeed = 0
	CamaraJugador.CameraType = Enum.CameraType.Scriptable
	CamaraJugador.CFrame = Camara1.CFrame
	task.wait(0.5)
	local AnimacionCamara1 = TweenS:Create(CamaraJugador,TweenI,{CFrame = Camara2.CFrame})
	AnimacionCamara1:Play()
	AnimacionCamara1.Completed:Wait()
end

--hacer que la animacion se reproduzca solo cuando el juego este cargado
repeat wait() until game:IsLoaded()
wait(0.5)
IntroActivada()
1 Like

local script runs before everything loads so it needs to wait until instances it tries to get are loaded

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.