Why am I getting this error?
14:41:22.369 Workspace.StarJ3M.WallHop:18: attempt to index nil with 'Instance
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local root = char.PrimaryPart
local origion = root.Position
local direction = origion.Unit * Vector3.new(1, 1, 2)
local part = Instance.new("Part", workspace)
part.Anchored = true
part.Position = origion
part.Size = direction
while task.wait() do
part.Position = origion
part.Size = direction
local forwardRay = workspace:Raycast(origion, direction)
print(forwardRay.Instance)
end