Hello fellow developers, I’m having this problem with a script it’s where you learn new skills and jukes basically, for myself and it keeps saying “Workspace.Monster.Script:13: attempt to index nil with ‘Character’”, I don’t know what that means, obviously it can’t tell what a character is, but I don’t understand how I would make it understand it is.
What I want it to do: to chase the player
What it’s inside of: Character model
Here is the script,
local object = script.Parent
local human = object:WaitForChild("Humanoid")
local torso = object:WaitForChild("Torso")
local PathFindingService = game:GetService("PathfindingService")
local path = PathFindingService:CreatePath()
local player = players.LocalPlayer
local HRP = player.Character.HumanoidRootPart
local runservice = game:GetService("RunService")
runservice.Heartbeat:Connect(function()
path:ComputeAsync(torso.Position, HRP.Position)
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
human:ChangeState(Enum.HumanoidStateType.Jumping)
end
human:MoveTo(waypoint.Position)
human.MoveToFinished:Wait(2)
end
end)
Thanks!