I believe it does this because of a script in my game which I use for my spectate system to work. Here is the script:
Player = game.Players.LocalPlayer
sp = script.Parent
Spectating = false
Index = 1
Camera = workspace.CurrentCamera
UIS = game:GetService("UserInputService")
function Watch(player)
if player and player.Character and Camera.CameraSubject ~= player.Character then
Camera.CameraSubject = player.Character
script.Parent.CS.Text = "Currently Spectating: " .. player.name
end
end
function ChangeState(bool)
if bool == nil then
Spectating = not Spectating
else
Spectating = bool
end
if Spectating then
else
Watch(Player)
end
end
function CurrentMinigame()
return workspace.CurrentMinigame:GetChildren()[1]
end
function IncrementIndex(num)
local TempIndex = Index + num
local Minigame = CurrentMinigame()
local TempContestants = Minigame.MinigameInfo.TempContestants
local Contestants = TempContestants:GetChildren()
if TempIndex > #Contestants then
TempIndex = 1
elseif TempIndex < 1 then
TempIndex = #Contestants
end
Index = TempIndex
end
script.Parent.Parent.Main.SpectateButton.MouseButton1Click:connect(function()
ChangeState()
end)
UIS.InputBegan:connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
IncrementIndex(-1)
elseif Input.KeyCode == Enum.KeyCode.E then
IncrementIndex(1)
end
end)
script.Parent.PreviousButton.MouseButton1Click:connect(function()
IncrementIndex(-1)
end)
script.Parent.NextButton.MouseButton1Click:connect(function()
IncrementIndex(1)
end)
game:GetService("RunService").RenderStepped:connect(function()
local Minigame = CurrentMinigame()
if Minigame then
local TempContestants = Minigame.MinigameInfo.TempContestants
local Contestants = TempContestants:GetChildren()
if not TempContestants:FindFirstChild(Player.Name) then
if Spectating then
IncrementIndex(0)
Watch(Contestants[Index].Value)
end
else
script.Parent.Parent.Main.SpectateButton.Visible = false
ChangeState(true)
end
else
script.Parent.Parent.Main.SpectateButton.Visible = false
ChangeState(false)
end
end)
Player = game.Players.LocalPlayer
sp = script.Parent
Spectating = false
Index = 1
Camera = workspace.CurrentCamera
UIS = game:GetService("UserInputService")
function Watch(player)
if player and player.Character.Humanoid and Camera.CameraSubject ~= player.Character.Humanoid then
Camera.CameraSubject = player.Character.Humanoid
script.Parent.CS.Text = "Currently Spectating: " .. player.name
end
end
function ChangeState(bool)
if bool == nil then
Spectating = not Spectating
else
Spectating = bool
end
if Spectating then
else
Watch(Player)
end
end
function CurrentMinigame()
return workspace.CurrentMinigame:GetChildren()[1]
end
function IncrementIndex(num)
local TempIndex = Index + num
local Minigame = CurrentMinigame()
local TempContestants = Minigame.MinigameInfo.TempContestants
local Contestants = TempContestants:GetChildren()
if TempIndex > #Contestants then
TempIndex = 1
elseif TempIndex < 1 then
TempIndex = #Contestants
end
Index = TempIndex
end
script.Parent.Parent.Main.SpectateButton.MouseButton1Click:connect(function()
ChangeState()
end)
UIS.InputBegan:connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
IncrementIndex(-1)
elseif Input.KeyCode == Enum.KeyCode.E then
IncrementIndex(1)
end
end)
script.Parent.PreviousButton.MouseButton1Click:connect(function()
IncrementIndex(-1)
end)
script.Parent.NextButton.MouseButton1Click:connect(function()
IncrementIndex(1)
end)
game:GetService("RunService").RenderStepped:connect(function()
local Minigame = CurrentMinigame()
if Minigame then
local TempContestants = Minigame.MinigameInfo.TempContestants
local Contestants = TempContestants:GetChildren()
if not TempContestants:FindFirstChild(Player.Name) then
if Spectating then
IncrementIndex(0)
Watch(Contestants[Index].Value)
end
else
script.Parent.Parent.Main.SpectateButton.Visible = false
ChangeState(true)
end
else
script.Parent.Parent.Main.SpectateButton.Visible = false
ChangeState(false)
end
end)
I now get this error:
Humanoid is not a valid member of Model
It errors on this line of code:
if player and player.Character.Humanoid and Camera.CameraSubject ~= player.Character.Humanoid then
Also, I’ll be honest, I got this code from a tutorial.